Dependency Injection container.
Methods
Constructor should not be used.
__construct()
Specify a dependency lookup for the constructor of the previously
registered item.
addConstructorLookup(string $lookup) : \Swift_DependencyContainer
Parameters
$lookup
string
Returns
Specify a literal (non looked up) value for the constructor of the
previously registered item.
addConstructorValue(mixed $value) : \Swift_DependencyContainer
Parameters
$value
mixed
Returns
Specify the previously registered item as an alias of another item.
asAliasOf(string $lookup) : \Swift_DependencyContainer
Parameters
$lookup
string
Returns
Specify the previously registered item as a new instance of $className.
asNewInstanceOf(string $className) : \Swift_DependencyContainer
Parameters
$className
string
Returns
Specify the previously registered item as a shared instance of $className.
asSharedInstanceOf(string $className) : \Swift_DependencyContainer
Parameters
$className
string
Returns
Specify the previously registered item as a literal value.
asValue(mixed $value) : \Swift_DependencyContainer
Parameters
$value
mixed
Returns
Create an array of arguments passed to the constructor of $itemName.
createDependenciesFor(string $itemName) : array
Parameters
$itemName
string
Returns
array
Test if an item is registered in this container with the given name.
has(string $itemName) : boolean
Parameters
$itemName
string
Returns
boolean
List the names of all items stored in the Container.
listItems() : array
Lookup the item with the given $itemName.
lookup(string $itemName) : mixed
Parameters
$itemName
string
Exceptions
Returns
mixed
Register a new dependency with $itemName.
register(string $itemName) : \Swift_DependencyContainer
This method returns the current DependencyContainer instance because it
requires the use of the fluid interface to set the specific details for the
dependency.
Parameters
$itemName
string
Returns
Specify a list of injected dependencies for the previously registered item.
withDependencies(array $lookups) : \Swift_DependencyContainer
This method takes an array of lookup names.
Parameters
$lookups
array
Returns
Resolve an alias to another item
_createAlias($itemName)
Create a fresh instance of $itemName
_createNewInstance($itemName)
Create and register a shared instance of $itemName
_createSharedInstance($itemName)
Get the current endpoint in the store
_getEndPoint()
Get the literal value with $itemName
_getValue($itemName)
Resolve a single dependency with an collections
_lookupRecursive($item)
Get an argument list with dependencies resolved
_resolveArgs(array $args)
Properties
Constants
Constant for aliases
TYPE_ALIAS
Constant for new instance types
TYPE_INSTANCE
Constant for shared instance types
TYPE_SHARED
Constant for literal value types
TYPE_VALUE