TYPO3
7.6
|
Public Member Functions | |
__construct () | |
listItems () | |
has ($itemName) | |
lookup ($itemName) | |
createDependenciesFor ($itemName) | |
register ($itemName) | |
asValue ($value) | |
asAliasOf ($lookup) | |
asNewInstanceOf ($className) | |
asSharedInstanceOf ($className) | |
withDependencies (array $lookups) | |
addConstructorValue ($value) | |
addConstructorLookup ($lookup) | |
Static Public Member Functions | |
static | getInstance () |
Public Attributes | |
const | TYPE_VALUE = 0x0001 |
const | TYPE_INSTANCE = 0x0010 |
const | TYPE_SHARED = 0x0100 |
const | TYPE_ALIAS = 0x1000 |
Private Member Functions | |
_getValue ($itemName) | |
_createAlias ($itemName) | |
_createNewInstance ($itemName) | |
_createSharedInstance ($itemName) | |
& | _getEndPoint () |
_resolveArgs (array $args) | |
_lookupRecursive ($item) | |
Private Attributes | |
$_store = array() | |
$_endPoint | |
Static Private Attributes | |
static | $_instance = null |
Dependency Injection container.
Definition at line 16 of file DependencyContainer.php.
__construct | ( | ) |
Constructor should not be used.
Use getInstance() instead.
Definition at line 44 of file DependencyContainer.php.
|
private |
Resolve an alias to another item
Definition at line 301 of file DependencyContainer.php.
References lookup().
Referenced by lookup().
|
private |
Create a fresh instance of $itemName
Definition at line 307 of file DependencyContainer.php.
References createDependenciesFor().
Referenced by _createSharedInstance(), and lookup().
|
private |
Create and register a shared instance of $itemName
Definition at line 320 of file DependencyContainer.php.
References _createNewInstance().
Referenced by lookup().
|
private |
Get the current endpoint in the store
Definition at line 330 of file DependencyContainer.php.
References $_endPoint.
Referenced by addConstructorLookup(), addConstructorValue(), asAliasOf(), asNewInstanceOf(), asSharedInstanceOf(), asValue(), and withDependencies().
|
private |
Get the literal value with $itemName
Definition at line 295 of file DependencyContainer.php.
Referenced by lookup().
|
private |
Resolve a single dependency with an collections
Definition at line 360 of file DependencyContainer.php.
References lookup().
Referenced by _resolveArgs().
|
private |
Get an argument list with dependencies resolved
Definition at line 342 of file DependencyContainer.php.
References _lookupRecursive().
Referenced by createDependenciesFor().
addConstructorLookup | ( | $lookup | ) |
Specify a dependency lookup for the constructor of the previously registered item.
string | $lookup |
Definition at line 283 of file DependencyContainer.php.
References _getEndPoint().
Referenced by withDependencies().
addConstructorValue | ( | $value | ) |
Specify a literal (non looked up) value for the constructor of the previously registered item.
mixed | $value |
Definition at line 262 of file DependencyContainer.php.
References _getEndPoint().
asAliasOf | ( | $lookup | ) |
Specify the previously registered item as an alias of another item.
string | $lookup |
Definition at line 181 of file DependencyContainer.php.
References _getEndPoint().
asNewInstanceOf | ( | $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().
string | $className |
Definition at line 203 of file DependencyContainer.php.
References _getEndPoint().
asSharedInstanceOf | ( | $className | ) |
Specify the previously registered item as a shared instance of $className.
register() must be called before this will work.
string | $className |
Definition at line 221 of file DependencyContainer.php.
References _getEndPoint().
asValue | ( | $value | ) |
Specify the previously registered item as a literal value.
register() must be called before this will work.
mixed | $value |
Definition at line 165 of file DependencyContainer.php.
References _getEndPoint().
createDependenciesFor | ( | $itemName | ) |
Create an array of arguments passed to the constructor of $itemName.
string | $itemName |
Definition at line 125 of file DependencyContainer.php.
References _resolveArgs().
Referenced by _createNewInstance().
|
static |
Returns a singleton of the DependencyContainer.
Definition at line 53 of file DependencyContainer.php.
Referenced by Swift_NullTransport\__construct(), Swift_FailoverTransport\__construct(), Swift_SendmailTransport\__construct(), Swift_LoadBalancedTransport\__construct(), Swift_SpoolTransport\__construct(), Swift_MailTransport\__construct(), Swift_EmbeddedFile\__construct(), Swift_MimePart\__construct(), Swift_Attachment\__construct(), Swift_SmtpTransport\__construct(), Swift_Message\__construct(), Swift_Signers_SMimeSigner\__construct(), Swift_Message\__wakeup(), Swift_Encoding\_lookup(), Swift_Mailer\createMessage(), Swift_Validate\email(), Swift_Preferences\setCacheType(), Swift_Preferences\setCharset(), Swift_Preferences\setQPDotEscape(), Swift_Preferences\setTempDir(), Swift_Signers_SMimeSigner\signMessage(), and Swift_Signers_SMimeSigner\streamToMime().
has | ( | $itemName | ) |
Test if an item is registered in this container with the given name.
string | $itemName |
Definition at line 81 of file DependencyContainer.php.
Referenced by lookup().
listItems | ( | ) |
List the names of all items stored in the Container.
Definition at line 67 of file DependencyContainer.php.
lookup | ( | $itemName | ) |
Lookup the item with the given $itemName.
string | $itemName |
Swift_DependencyException | If the dependency is not found |
Definition at line 98 of file DependencyContainer.php.
References _createAlias(), _createNewInstance(), _createSharedInstance(), _getValue(), and has().
Referenced by _createAlias(), and _lookupRecursive().
register | ( | $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.
string | $itemName |
Definition at line 148 of file DependencyContainer.php.
withDependencies | ( | array | $lookups | ) |
Specify a list of injected dependencies for the previously registered item.
This method takes an array of lookup names.
array | $lookups |
Definition at line 241 of file DependencyContainer.php.
References _getEndPoint(), and addConstructorLookup().
|
private |
The current endpoint in the data container
Definition at line 37 of file DependencyContainer.php.
Referenced by _getEndPoint().
|
staticprivate |
Singleton instance
Definition at line 31 of file DependencyContainer.php.
|
private |
The data container
Definition at line 34 of file DependencyContainer.php.
const TYPE_ALIAS = 0x1000 |
Constant for aliases
Definition at line 28 of file DependencyContainer.php.
const TYPE_INSTANCE = 0x0010 |
Constant for new instance types
Definition at line 22 of file DependencyContainer.php.
const TYPE_SHARED = 0x0100 |
Constant for shared instance types
Definition at line 25 of file DependencyContainer.php.
const TYPE_VALUE = 0x0001 |
Constant for literal value types
Definition at line 19 of file DependencyContainer.php.