PHP 클래스 DI\Definition\Helper\ObjectDefinitionHelper

저자: Matthieu Napoli ([email protected])
상속: implements DI\Definition\Helper\DefinitionHelper
파일 보기 프로젝트 열기: mnapoli/php-di

공개 메소드들

메소드 설명
__construct ( string | null $className = null ) Helper for defining an object.
constructor ( ) : ObjectDefinitionHelper Defines the arguments to use to call the constructor.
constructorParameter ( string $parameter, mixed $value ) : ObjectDefinitionHelper Defines a value for a specific argument of the constructor.
getDefinition ( $entryName )
lazy ( ) : ObjectDefinitionHelper Define the entry as lazy.
method ( string $method ) : ObjectDefinitionHelper Defines a method to call and the arguments to use.
methodParameter ( string $method, string $parameter, mixed $value ) : ObjectDefinitionHelper Defines a method to call and a value for a specific argument.
property ( string $property, mixed $value ) : ObjectDefinitionHelper Defines a value to inject in a property of the object.
scope ( string $scope ) : ObjectDefinitionHelper Defines the scope of the entry.

비공개 메소드들

메소드 설명
fixParameters ( ObjectDefinition $definition, string $method, array $parameters ) : array Fixes parameters indexed by the parameter name -> reindex by position.

메소드 상세

__construct() 공개 메소드

Helper for defining an object.
public __construct ( string | null $className = null )
$className string | null Class name of the object. If null, the name of the entry (in the container) will be used as class name.

constructor() 공개 메소드

This method takes a variable number of arguments, example: ->constructor($param1, $param2, $param3)
public constructor ( ) : ObjectDefinitionHelper
리턴 ObjectDefinitionHelper

constructorParameter() 공개 메소드

This method is usually used together with annotations or autowiring, when a parameter is not (or cannot be) type-hinted. Using this method instead of constructor() allows to avoid defining all the parameters (letting them being resolved using annotations or autowiring) and only define one.
public constructorParameter ( string $parameter, mixed $value ) : ObjectDefinitionHelper
$parameter string Parameter for which the value will be given.
$value mixed Value to give to this parameter.
리턴 ObjectDefinitionHelper

getDefinition() 공개 메소드

public getDefinition ( $entryName )

lazy() 공개 메소드

A lazy entry is created only when it is used, a proxy is injected instead.
public lazy ( ) : ObjectDefinitionHelper
리턴 ObjectDefinitionHelper

method() 공개 메소드

This method takes a variable number of arguments after the method name, example: ->method('myMethod', $param1, $param2) Can be used multiple times to declare multiple calls.
public method ( string $method ) : ObjectDefinitionHelper
$method string Name of the method to call.
리턴 ObjectDefinitionHelper

methodParameter() 공개 메소드

This method is usually used together with annotations or autowiring, when a parameter is not (or cannot be) type-hinted. Using this method instead of method() allows to avoid defining all the parameters (letting them being resolved using annotations or autowiring) and only define one. If multiple calls to the method have been configured already (e.g. in a previous definition) then this method only overrides the parameter for the *first* call.
public methodParameter ( string $method, string $parameter, mixed $value ) : ObjectDefinitionHelper
$method string Name of the method to call.
$parameter string Name or index of the parameter for which the value will be given.
$value mixed Value to give to this parameter.
리턴 ObjectDefinitionHelper

property() 공개 메소드

Defines a value to inject in a property of the object.
public property ( string $property, mixed $value ) : ObjectDefinitionHelper
$property string Entry in which to inject the value.
$value mixed Value to inject in the property.
리턴 ObjectDefinitionHelper

scope() 공개 메소드

Defines the scope of the entry.
public scope ( string $scope ) : ObjectDefinitionHelper
$scope string
리턴 ObjectDefinitionHelper