Swift
[ class tree: Swift ] [ index: Swift ] [ all elements ]

Class: Swift_DependencyContainer

Source Location: /vendors/swift/classes/Swift/DependencyContainer.php

Class Overview


Dependency Injection container.


Author(s):

  • Chris Corbyn

Constants

Methods



Class Details

[line 18]
Dependency Injection container.



Tags:

author:  Chris Corbyn
filesource:  Source Code for this file


[ Top ]


Class Methods


static method getInstance [line 52]

static Swift_DependencyContainer getInstance( )

Returns a singleton of the DependencyContainer.



Tags:

access:  public


[ Top ]

constructor __construct [line 46]

Swift_DependencyContainer __construct( )

Constructor should not be used.

Use getInstance() instead.




Tags:

access:  public


[ Top ]

method addConstructorLookup [line 249]

Swift_DependencyContainer addConstructorLookup( string $lookup)

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



Tags:



Parameters:

string   $lookup  

[ Top ]

method addConstructorValue [line 230]

Swift_DependencyContainer addConstructorValue( mixed $value)

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



Tags:



Parameters:

mixed   $value  

[ Top ]

method asAliasOf [line 163]

Swift_DependencyContainer asAliasOf( string $lookup)

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



Tags:

access:  public


Parameters:

string   $lookup  

[ Top ]

method asNewInstanceOf [line 181]

Swift_DependencyContainer asNewInstanceOf( string $className)

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

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




Tags:



Parameters:

string   $className  

[ Top ]

method asSharedInstanceOf [line 195]

Swift_DependencyContainer asSharedInstanceOf( string $className)

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

register() must be called before this will work.




Tags:

access:  public


Parameters:

string   $className  

[ Top ]

method asValue [line 150]

Swift_DependencyContainer asValue( mixed $value)

Specify the previously registered item as a literal value.

register() must be called before this will work.




Tags:

access:  public


Parameters:

mixed   $value  

[ Top ]

method createDependenciesFor [line 116]

array createDependenciesFor( string $itemName)

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



Tags:

access:  public


Parameters:

string   $itemName  

[ Top ]

method has [line 76]

boolean has( string $itemName)

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



Tags:

see:  Swift_DependencyContainer::register()
access:  public


Parameters:

string   $itemName  

[ Top ]

method listItems [line 65]

array listItems( )

List the names of all items stored in the Container.



Tags:

access:  public


[ Top ]

method lookup [line 89]

mixed lookup( string $itemName)

Lookup the item with the given $itemName.



Tags:

see:  Swift_DependencyContainer::register()
throws:  Swift_DependencyException If the dependency is not found
access:  public


Parameters:

string   $itemName  

[ Top ]

method register [line 136]

Swift_DependencyContainer register( string $itemName)

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.




Tags:



Parameters:

string   $itemName  

[ Top ]

method withDependencies [line 211]

Swift_DependencyContainer withDependencies( $lookups)

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

This method takes an array of lookup names.




Tags:



Parameters:

array   $lookups  

[ Top ]


Class Constants

TYPE_ALIAS =  0x1000

[line 31]

Constant for aliases


[ Top ]

TYPE_INSTANCE =  0x0010

[line 25]

Constant for new instance types


[ Top ]

TYPE_SHARED =  0x0100

[line 28]

Constant for shared instance types


[ Top ]

TYPE_VALUE =  0x0001

[line 22]

Constant for literal value types


[ Top ]



Documentation generated on Mon, 05 Sep 2011 20:33:05 -0500 by phpDocumentor 1.4.3