PHP Class Ding\Container\Impl\ContainerImpl

PHP Version 5
Author: Marcelo Gornstein ([email protected])
Inheritance: implements Ding\Container\IContainer
显示文件 Open project: marcelog/ding Class Usage Examples

Public Methods

Method Description
__destruct ( ) : void Destructor, will call all beans destroy-methods.
__sleep ( ) : array Prevent serialization.
errorHandler ( integer $type, string $message, string $file, integer $line ) : true Called by php after set_error_handler()
eventDispatch ( $eventName, $data = null ) (non-PHPdoc)
eventListen ( $eventName, $beanName ) (non-PHPdoc)
fillAware ( Ding\Bean\BeanDefinition $def, object $bean ) : void Will look for "aware" kind of interfaces and inject whatever necessary.
getBean ( string $name ) : object Returns a bean.
getBeanDefinition ( string $name ) : Ding\Bean\BeanDefinition Returns a bean definition.
getBeansByClass ( $class ) (non-PHPdoc)
getBeansListeningOn ( $eventName ) (non-PHPdoc)
getInstance ( array $properties = [] ) : ContainerImpl This will return a container
getMessage ( $bundle, $message, array $arguments, $locale = 'default' ) (non-PHPdoc)
getResource ( $location, $context = false ) (non-PHPdoc)
registerBeanDefinitionProvider ( Ding\Bean\IBeanDefinitionProvider $provider ) (non-PHPdoc)
registerProperties ( array $properties ) (non-PHPdoc)
registerShutdownMethod ( object $bean, string $method ) : void Register a shutdown (destroy-method) method for a bean.
setMessageSource ( Ding\MessageSource\IMessageSource $messageSource ) Enter description here .
shutdownHandler ( ) : void Called by the vm after register_shutdown_function()
signalHandler ( integer $signo ) : void Called when a signal is caught.

Protected Methods

Method Description
__construct ( array $options ) : void Constructor.
getClass ( string $class ) : ReflectionClass If we dont have a ReflectionFactory yet (i.e: didnt make the call to getBean() yet), replace it with this one.

Private Methods

Method Description
_applyAspect ( $targetClass, Ding\Aspect\AspectDefinition $aspectDefinition, Ding\Aspect\Interceptor\IDispatcher $dispatcher ) : void Will inject into the given dispatcher the necessary information to aspects will be run correctly.
_applyAspects ( Ding\Bean\BeanDefinition $definition ) : void Applies specific bean aspects and global defined aspects.
_applyGlobalAspects ( Ding\Bean\BeanDefinition $definition, Ding\Aspect\Interceptor\IDispatcher $dispatcher ) : void Looks for any global aspects that may apply to this bean and applies them.
_applySpecificAspects ( Ding\Bean\BeanDefinition $definition, Ding\Aspect\Interceptor\IDispatcher $dispatcher ) : void Applies all aspects specifically defined for this bean definition.
_assemble ( mixed $bean, Ding\Bean\BeanDefinition $beanDefinition ) : void Assembles a bean (setter injection)
_createBean ( Ding\Bean\BeanDefinition $definition ) : object This will create a new bean, injecting all properties and applying all aspects.
_createBeanDependencies ( Ding\Bean\BeanDefinition $definition ) : void Creates whatever beans this definition depends on.
_getConstructorValuesForDefinition ( Ding\Bean\BeanDefinition $definition ) : object Resolves all values for constructor arguments definitions in a bean definition.
_getValueFromDefinition ( Ding\Bean\BeanPropertyDefinition | Ding\Bean\BeanConstructorArgumentDefinition $what ) : void This will resolve a property (or constructor arg) definition to a final value, being a bean reference, array of other properties (or constructor args), etc.
_instantiate ( Ding\Bean\BeanDefinition $definition ) : object Instantiates a bean.
_instantiateByConstructor ( Ding\Bean\BeanDefinition $definition ) : object Instantiates a bean using the constructor.
_instantiateByFactoryBean ( Ding\Bean\BeanDefinition $definition ) : object Instantiates a bean using a factory bean.
_instantiateByFactoryClass ( Ding\Bean\BeanDefinition $definition ) : object Instantiates a bean using a factory class.
_loadValue ( mixed $value ) : mixed Takes care of transforming a scalar value for a property or constructor argument, into a an actual value (i.e: if its a resource://, loading it first).
_nonSetterMethodInject ( object $bean, string $name, string $value ) : boolean Tries to inject by looking up a method of the given name.
_propertyInject ( object $bean, string $name, string $value ) : boolean Tries to inject by looking up a property by name.
_searchAndReplaceProperties ( string $value ) : string Will try to search and replace the properties found in the given value.
_setterInject ( object $bean, string $name, string $value ) : boolean Tries to inject by looking up set* methods.
_setupInitAndShutdown ( object $bean, Ding\Bean\BeanDefinition $definition ) : void Calls init method and register shutdown method.
_sortArgsWithNames ( Ding\Bean\BeanDefinition $definition, ReflectionMethod $rMethod )

Method Details

__construct() protected method

Constructor.
protected __construct ( array $options ) : void
$options array options.
return void

__destruct() public method

Destructor, will call all beans destroy-methods.
public __destruct ( ) : void
return void

__sleep() public method

Prevent serialization.
public __sleep ( ) : array
return array

errorHandler() public method

Called by php after set_error_handler()
public errorHandler ( integer $type, string $message, string $file, integer $line ) : true
$type integer
$message string
$file string
$line integer
return true

eventDispatch() public method

(non-PHPdoc)
public eventDispatch ( $eventName, $data = null )

eventListen() public method

(non-PHPdoc)
public eventListen ( $eventName, $beanName )

fillAware() public method

Will look for "aware" kind of interfaces and inject whatever necessary.
public fillAware ( Ding\Bean\BeanDefinition $def, object $bean ) : void
$def Ding\Bean\BeanDefinition The Bean Definition
$bean object The bean
return void

getBean() public method

Returns a bean.
public getBean ( string $name ) : object
$name string Bean name.
return object

getBeanDefinition() public method

Returns a bean definition.
public getBeanDefinition ( string $name ) : Ding\Bean\BeanDefinition
$name string Bean name.
return Ding\Bean\BeanDefinition

getBeansByClass() public method

(non-PHPdoc)
public getBeansByClass ( $class )

getBeansListeningOn() public method

(non-PHPdoc)
public getBeansListeningOn ( $eventName )

getClass() protected method

If we dont have a ReflectionFactory yet (i.e: didnt make the call to getBean() yet), replace it with this one.
protected getClass ( string $class ) : ReflectionClass
$class string The name of a class.
return ReflectionClass

getInstance() public static method

This will return a container
public static getInstance ( array $properties = [] ) : ContainerImpl
$properties array Container properties.
return ContainerImpl

getMessage() public method

(non-PHPdoc)
public getMessage ( $bundle, $message, array $arguments, $locale = 'default' )
$arguments array

getResource() public method

(non-PHPdoc)
public getResource ( $location, $context = false )

registerBeanDefinitionProvider() public method

(non-PHPdoc)
public registerBeanDefinitionProvider ( Ding\Bean\IBeanDefinitionProvider $provider )
$provider Ding\Bean\IBeanDefinitionProvider

registerProperties() public method

(non-PHPdoc)
public registerProperties ( array $properties )
$properties array

registerShutdownMethod() public method

Register a shutdown (destroy-method) method for a bean.
public registerShutdownMethod ( object $bean, string $method ) : void
$bean object Bean to call.
$method string Method to call.
return void

setMessageSource() public method

..
public setMessageSource ( Ding\MessageSource\IMessageSource $messageSource )
$messageSource Ding\MessageSource\IMessageSource

shutdownHandler() public method

Called by the vm after register_shutdown_function()
public shutdownHandler ( ) : void
return void

signalHandler() public method

Called when a signal is caught.
public signalHandler ( integer $signo ) : void
$signo integer
return void