Symfony\Component\DependencyInjection\Definition::getArgument PHP Method

getArgument() public method

Gets an argument to pass to the service constructor/factory method.
public getArgument ( integer $index ) : mixed
$index integer
return mixed The argument value
    public function getArgument($index)
    {
        if ($index < 0 || $index > count($this->arguments) - 1) {
            throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));
        }

        return $this->arguments[$index];
    }

Usage Example

 private function resolverContainsBufferHandler($expectedResolverIds)
 {
     $actualResolverIds = [];
     foreach ($this->closeBufferHandlersDefinition->getArgument(0) as $argument) {
         $this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $argument);
         $actualResolverIds[] = (string) $argument;
     }
     $this->assertEquals($expectedResolverIds, $actualResolverIds);
 }
All Usage Examples Of Symfony\Component\DependencyInjection\Definition::getArgument