Class Swift_DependencyContainer

InheritanceSwift_DependencyContainer

Dependency Injection container.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor should not be used. Swift_DependencyContainer
addConstructorLookup() Specify a dependency lookup for the constructor of the previously registered item. Swift_DependencyContainer
addConstructorValue() Specify a literal (non looked up) value for the constructor of the previously registered item. Swift_DependencyContainer
asAliasOf() Specify the previously registered item as an alias of another item. Swift_DependencyContainer
asNewInstanceOf() Specify the previously registered item as a new instance of $className. Swift_DependencyContainer
asSharedInstanceOf() Specify the previously registered item as a shared instance of $className. Swift_DependencyContainer
asValue() Specify the previously registered item as a literal value. Swift_DependencyContainer
createDependenciesFor() Create an array of arguments passed to the constructor of $itemName. Swift_DependencyContainer
getInstance() Returns a singleton of the DependencyContainer. Swift_DependencyContainer
has() Test if an item is registered in this container with the given name. Swift_DependencyContainer
listItems() List the names of all items stored in the Container. Swift_DependencyContainer
lookup() Lookup the item with the given $itemName. Swift_DependencyContainer
register() Register a new dependency with $itemName. Swift_DependencyContainer
withDependencies() Specify a list of injected dependencies for the previously registered item. Swift_DependencyContainer

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
TYPE_ALIAS 4096 Constant for aliases Swift_DependencyContainer
TYPE_INSTANCE 16 Constant for new instance types Swift_DependencyContainer
TYPE_SHARED 256 Constant for shared instance types Swift_DependencyContainer
TYPE_VALUE 1 Constant for literal value types Swift_DependencyContainer

Method Details

__construct() public method

Constructor should not be used.

Use {@link getInstance()} instead.

public void __construct ( )
addConstructorLookup() public method

Specify a dependency lookup for the constructor of the previously registered item.

See also [[withDependencies(),]] addConstructorValue().

public Swift_DependencyContainer addConstructorLookup ( $lookup )
$lookup string
addConstructorValue() public method

Specify a literal (non looked up) value for the constructor of the previously registered item.

See also [[withDependencies(),]] addConstructorLookup().

public Swift_DependencyContainer addConstructorValue ( $value )
$value mixed
asAliasOf() public method

Specify the previously registered item as an alias of another item.

public Swift_DependencyContainer asAliasOf ( $lookup )
$lookup string
asNewInstanceOf() public method

Specify the previously registered item as a new instance of $className.

{@link register()} must be called before this will work. Any arguments can be set with {@link withDependencies()}, {@link addConstructorValue()} or {@link addConstructorLookup()}.

See also [[withDependencies(),]] addConstructorValue(), addConstructorLookup().

public Swift_DependencyContainer asNewInstanceOf ( $className )
$className string
asSharedInstanceOf() public method

Specify the previously registered item as a shared instance of $className.

{@link register()} must be called before this will work.

public Swift_DependencyContainer asSharedInstanceOf ( $className )
$className string
asValue() public method

Specify the previously registered item as a literal value.

{@link register()} must be called before this will work.

public Swift_DependencyContainer asValue ( $value )
$value mixed
createDependenciesFor() public method

Create an array of arguments passed to the constructor of $itemName.

public array createDependenciesFor ( $itemName )
$itemName string
getInstance() public static method

Returns a singleton of the DependencyContainer.

public static Swift_DependencyContainer getInstance ( )
has() public method

Test if an item is registered in this container with the given name.

See also register().

public bool has ( $itemName )
$itemName string
listItems() public method

List the names of all items stored in the Container.

public array listItems ( )
lookup() public method

Lookup the item with the given $itemName.

See also register().

public mixed lookup ( $itemName )
$itemName string
throws Swift_DependencyException

If the dependency is not found

register() public method

Register a new dependency with $itemName.

This method returns the current DependencyContainer instance because it requires the use of the fluid interface to set the specific details for the dependency.

See also [[asNewInstanceOf(),]] asSharedInstanceOf(), asValue().

public Swift_DependencyContainer register ( $itemName )
$itemName string
withDependencies() public method

Specify a list of injected dependencies for the previously registered item.

This method takes an array of lookup names.

See also [[addConstructorValue(),]] addConstructorLookup().

public Swift_DependencyContainer withDependencies ( array $lookups )
$lookups array