[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Source view] [Print] [Project Stats]
Part of the Joomla Framework DI Package
Copyright: | Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved. |
License: | GNU General Public License version 2 or later; see LICENSE |
File Size: | 782 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Container:: (23 methods):
__construct()
get()
has()
exists()
alias()
resolveAlias()
isShared()
isProtected()
hasFlag()
tag()
getTagged()
buildObject()
buildSharedObject()
createChild()
extend()
getMethodArgs()
set()
protect()
share()
getResource()
getNewInstance()
registerServiceProvider()
getKeys()
__construct(?ContainerInterface $parent = null) X-Ref |
Constructor for the DI Container param: ContainerInterface|null $parent Parent for hierarchical containers. |
get($resourceName) X-Ref |
Retrieve a resource param: string $resourceName Name of the resource to get. return: mixed The requested resource |
has($resourceName) X-Ref |
Check if specified resource exists. param: string $resourceName Name of the resource to check. return: boolean true if key is defined, false otherwise |
exists($key) X-Ref |
Method to check if specified dataStore key exists. param: string $key Name of the dataStore key to check. return: boolean True for success |
alias($alias, $key) X-Ref |
Create an alias for a given key for easy access. param: string $alias The alias name param: string $key The key to alias return: $this |
resolveAlias($resourceName) X-Ref |
Resolve a resource name. If the resource name is an alias, the corresponding key is returned. If the resource name is not an alias, the resource name is returned unchanged. param: string $resourceName The key to search for. return: string |
isShared(string $resourceName) X-Ref |
Check whether a resource is shared param: string $resourceName Name of the resource to check. return: boolean |
isProtected(string $resourceName) X-Ref |
Check whether a resource is protected param: string $resourceName Name of the resource to check. return: boolean |
hasFlag(string $resourceName, string $method, bool $default = true) X-Ref |
Check whether a flag (i.e., one of 'shared' or 'protected') is set param: string $resourceName Name of the resource to check. param: string $method Method to delegate to param: boolean $default Default return value return: boolean |
tag($tag, array $keys) X-Ref |
Assign a tag to services. param: string $tag The tag name param: array $keys The service keys to tag return: $this |
getTagged($tag) X-Ref |
Fetch all services registered to the given tag. param: string $tag The tag name return: array The resolved services for the given tag |
buildObject($resourceName, $shared = false) X-Ref |
Build an object of the requested class Creates an instance of the class specified by $resourceName with all dependencies injected. If the dependencies cannot be completely resolved, a DependencyResolutionException is thrown. param: string $resourceName The class name to build. param: boolean $shared True to create a shared resource. return: object|false Instance of class specified by $resourceName with all dependencies injected. |
buildSharedObject($resourceName) X-Ref |
Convenience method for building a shared object. param: string $resourceName The class name to build. return: object|false Instance of class specified by $resourceName with all dependencies injected. |
createChild() X-Ref |
Create a child Container with a new property scope that has the ability to access the parent scope when resolving. return: Container A new container with the current as a parent |
extend($resourceName, callable $callable) X-Ref |
Extend a defined service Closure by wrapping the existing one with a new callable function. This works very similar to a decorator pattern. Note that this only works on service Closures that have been defined in the current container, not parent containers. param: string $resourceName The unique identifier for the Closure or property. param: callable $callable A callable to wrap the original service Closure. return: void |
getMethodArgs(\ReflectionMethod $method) X-Ref |
Build an array of method arguments. param: \ReflectionMethod $method Method for which to build the argument array. return: array Array of arguments to pass to the method. |
set($key, $value, $shared = false, $protected = false) X-Ref |
Set a resource to the container. If the value is null the resource is removed. param: string $key Name of resources key to set. param: mixed $value Callable function to run or string to retrive when requesting the specified $key. param: boolean $shared True to create and store a shared instance. param: boolean $protected True to protect this item from being overwritten. Useful for services. return: $this |
protect($key, $value, $shared = false) X-Ref |
Shortcut method for creating protected keys. param: string $key Name of dataStore key to set. param: mixed $value Callable function to run or string to retrive when requesting the specified $key. param: boolean $shared True to create and store a shared instance. return: $this |
share($key, $value, $protected = false) X-Ref |
Shortcut method for creating shared keys. param: string $key Name of dataStore key to set. param: mixed $value Callable function to run or string to retrive when requesting the specified $key. param: boolean $protected True to protect this item from being overwritten. Useful for services. return: $this |
getResource(string $key, bool $bail = false) X-Ref |
Get the raw data assigned to a key. param: string $key The key for which to get the stored item. param: boolean $bail Throw an exception, if the key is not found return: ContainerResource|null The resource if present, or null if instructed to not bail |
getNewInstance($key) X-Ref |
Method to force the container to return a new instance of the results of the callback for requested $key. param: string $key Name of the resources key to get. return: mixed Results of running the callback for the specified key. |
registerServiceProvider(ServiceProviderInterface $provider) X-Ref |
Register a service provider to the container. param: ServiceProviderInterface $provider The service provider to register. return: $this |
getKeys() X-Ref |
Retrieve the keys for services assigned to this container. return: array |
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |