PHP Interface Kraken\Container\ServiceRegisterInterface

Show file Open project: kraken-php/framework

Public Methods

Method Description
boot ( ) Boot service register.
flushAliases ( ) Flush all registered aliases.
flushProviders ( ) Flush all registered providers.
getAlias ( string $alias ) : null | string Return target of given alias. If the alias is not found null will be returned.
getAliases ( ) : string[] Return list of all aliases and its targets in form of associative array.
getProvider ( Kraken\Container\ServiceProviderInterface | string $provider ) : Kraken\Container\ServiceProviderInterface | null Get registered ServiceProvider.
getProviders ( ) : string[] Gets list with classNames of all registered ServiceProvider.
getServices ( ) : string[] Gets list with classNames of all provided services.
registerAlias ( string $alias, string $existing ) Register service alias.
registerProvider ( Kraken\Container\ServiceProviderInterface | string $provider ) Register ServiceProvider.
unregisterAlias ( string $alias ) Unregister previously registered service alias.
unregisterProvider ( Kraken\Container\ServiceProviderInterface | string $provider ) Unregister previously registered ServiceProvider.

Method Details

boot() public method

On boot the following operations will be made: 1. existing providers will be sorted to resolve its dependency trees. 2. all providers will be registered meaning ::register() method will be fired on each of them. 3. all providers will be booted meaning ::boot() method will be fired on each of them. 4. existing aliases will be registered. ExecutionException is thrown if any of this steps fails.
public boot ( )

flushAliases() public method

This method flushes all registered aliases, if register is not booted. If the flush method is called after that the IllegalCallException will be thrown.
public flushAliases ( )

flushProviders() public method

This method flushes all registered providers, if they were not booted. If the flush method is called after that the IllegalCallException will be thrown.
public flushProviders ( )

getAlias() public method

Return target of given alias. If the alias is not found null will be returned.
public getAlias ( string $alias ) : null | string
$alias string
return null | string

getAliases() public method

Return list of all aliases and its targets in form of associative array.
public getAliases ( ) : string[]
return string[]

getProvider() public method

The $provider might be concrete object implementing ServiceProviderInterface or string representing the className. In both situations ServiceRegister will look up for already registered Provider of the same class and return it. If the object is not found, null will be returned.
public getProvider ( Kraken\Container\ServiceProviderInterface | string $provider ) : Kraken\Container\ServiceProviderInterface | null
$provider Kraken\Container\ServiceProviderInterface | string
return Kraken\Container\ServiceProviderInterface | null

getProviders() public method

Gets list with classNames of all registered ServiceProvider.
public getProviders ( ) : string[]
return string[]

getServices() public method

Gets list with classNames of all provided services.
public getServices ( ) : string[]
return string[]

registerAlias() public method

ExecutionException is thrown if Container::alias() method underneath throws any errors or exceptions. ResourceOccupiedException is thrown if alias is already registered.
public registerAlias ( string $alias, string $existing )
$alias string
$existing string

registerProvider() public method

The $provider might be concrete object implementing ServiceProviderInterface or string representing the className. In latter case, the object will be automatically created by ServiceRegister. If the provider is registered before boot its register method will be added to the queue of handlers to fire on boot. On the other hand, if register is registered after boot, its register method will be fired immediately. ExecutionException is thrown if register handler of ServiceProvider has thrown any exception or error. InvalidArgumentException is thrown if invalid Provider object or class was passed. ResourceOccupiedException is thrown if Provider of given class was already registered.
public registerProvider ( Kraken\Container\ServiceProviderInterface | string $provider )
$provider Kraken\Container\ServiceProviderInterface | string

unregisterAlias() public method

ResourceUndefinedException is thrown if alias is not registered.
public unregisterAlias ( string $alias )
$alias string

unregisterProvider() public method

The $provider might be concrete object implementing ServiceProviderInterface or string representing the className. In both situations ServiceRegister will look up for already registered Provider of the same class and unregister it. InvalidArgumentException is thrown if invalid Provider object or class was passed. ResourceUndefinedException is thrown if Provider of given class was not found.
public unregisterProvider ( Kraken\Container\ServiceProviderInterface | string $provider )
$provider Kraken\Container\ServiceProviderInterface | string