PHP Class Swift_DependencyContainer, Halite

Author: Chris Corbyn
Afficher le fichier Open project: HaliteChallenge/Halite Class Usage Examples

Méthodes publiques

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

Private Methods

Méthode Description
_createAlias ( $itemName ) Resolve an alias to another item
_createNewInstance ( $itemName ) Create a fresh instance of $itemName
_createSharedInstance ( $itemName ) Create and register a shared instance of $itemName
_getEndPoint ( ) Get the current endpoint in the store
_getValue ( $itemName ) Get the literal value with $itemName
_lookupRecursive ( $item ) Resolve a single dependency with an collections
_resolveArgs ( array $args ) Get an argument list with dependencies resolved

Method Details

__construct() public méthode

Use {@link getInstance()} instead.
public __construct ( )

addConstructorLookup() public méthode

Specify a dependency lookup for the constructor of the previously registered item.
public addConstructorLookup ( string $lookup ) : Swift_DependencyContainer
$lookup string
Résultat Swift_DependencyContainer

addConstructorValue() public méthode

Specify a literal (non looked up) value for the constructor of the previously registered item.
public addConstructorValue ( mixed $value ) : Swift_DependencyContainer
$value mixed
Résultat Swift_DependencyContainer

asAliasOf() public méthode

Specify the previously registered item as an alias of another item.
public asAliasOf ( string $lookup ) : Swift_DependencyContainer
$lookup string
Résultat Swift_DependencyContainer

asNewInstanceOf() public méthode

{@link register()} must be called before this will work. Any arguments can be set with {@link withDependencies()}, {@link addConstructorValue()} or {@link addConstructorLookup()}.
public asNewInstanceOf ( string $className ) : Swift_DependencyContainer
$className string
Résultat Swift_DependencyContainer

asSharedInstanceOf() public méthode

{@link register()} must be called before this will work.
public asSharedInstanceOf ( string $className ) : Swift_DependencyContainer
$className string
Résultat Swift_DependencyContainer

asValue() public méthode

{@link register()} must be called before this will work.
public asValue ( mixed $value ) : Swift_DependencyContainer
$value mixed
Résultat Swift_DependencyContainer

createDependenciesFor() public méthode

Create an array of arguments passed to the constructor of $itemName.
public createDependenciesFor ( string $itemName ) : array
$itemName string
Résultat array

getInstance() public static méthode

Returns a singleton of the DependencyContainer.
public static getInstance ( ) : Swift_DependencyContainer
Résultat Swift_DependencyContainer

has() public méthode

Test if an item is registered in this container with the given name.
See also: register()
public has ( string $itemName ) : boolean
$itemName string
Résultat boolean

listItems() public méthode

List the names of all items stored in the Container.
public listItems ( ) : array
Résultat array

lookup() public méthode

Lookup the item with the given $itemName.
See also: register()
public lookup ( string $itemName ) : mixed
$itemName string
Résultat mixed

register() public méthode

This method returns the current DependencyContainer instance because it requires the use of the fluid interface to set the specific details for the dependency.
public register ( string $itemName ) : Swift_DependencyContainer
$itemName string
Résultat Swift_DependencyContainer

withDependencies() public méthode

This method takes an array of lookup names.
public withDependencies ( array $lookups ) : Swift_DependencyContainer
$lookups array
Résultat Swift_DependencyContainer