PHP Class DI\Definition\FactoryDefinition

Author: Matthieu Napoli ([email protected])
Inheritance: implements DI\Definition\Definition
Show file Open project: mnapoli/php-di

Public Methods

Method Description
__construct ( string $name, callable $factory, string | null $scope = null, array $parameters = [] )
__toString ( )
getCallable ( ) : callable
getName ( ) : string
getParameters ( ) : array
getScope ( ) Default scope is singleton: the callable is called once and the result is shared.

Method Details

__construct() public method

public __construct ( string $name, callable $factory, string | null $scope = null, array $parameters = [] )
$name string Entry name
$factory callable Callable that returns the value associated to the entry name.
$scope string | null
$parameters array Parameters to be passed to the callable

__toString() public method

public __toString ( )

getCallable() public method

public getCallable ( ) : callable
return callable Callable that returns the value associated to the entry name.

getName() public method

public getName ( ) : string
return string Entry name.

getParameters() public method

public getParameters ( ) : array
return array Array containing the parameters to be passed to the callable, indexed by name.

getScope() public method

public getScope ( )