Gets an argument to pass to the service constructor/factory method.
public getArgument ( integer $index ) : mixed | ||
$index | integer | |
return | mixed | The argument value |
use Symfony\Component\DependencyInjection\Definition; $definition = new Definition(MyService::class); $argument = $definition->getArgument(0); // retrieves the first argument of the constructor
use Symfony\Component\DependencyInjection\Definition; $definition = new Definition(MyService::class); $definition->addMethodCall('setLogger', [$logger]); $argument = $definition->getArgument(1); // retrieves the second argument of the setLogger method callIn this example, we create a new service definition for the `MyService` class and add a method call to set its logger. We then retrieve the second argument of that method call. The package library for this method is `symfony/dependency-injection`.
public getArgument ( integer $index ) : mixed | ||
$index | integer | |
return | mixed | The argument value |