PHP Class Coduo\TuTu\ServiceContainer

Show file Open project: coduo/tutu Class Usage Examples

Public Methods

Method Description
getParameter ( $id ) : mixed
getService ( $id ) : mixed
getServicesByTag ( $tag ) : array
hasParameter ( $id ) : boolean
hasService ( $id ) : boolean
removeService ( $id )
setDefinition ( $id, Closure $definition, array $tags = [] ) getService($id) will return result of $definition closure.
setParameter ( $id, $value )
setStaticDefinition ( $id, Closure $definition, array $tags = [] ) Works just like setDefinition but getService($id) is going to return exactly same value every single time.

Method Details

getParameter() public method

public getParameter ( $id ) : mixed
$id
return mixed

getService() public method

public getService ( $id ) : mixed
$id
return mixed

getServicesByTag() public method

public getServicesByTag ( $tag ) : array
$tag
return array

hasParameter() public method

public hasParameter ( $id ) : boolean
$id
return boolean

hasService() public method

public hasService ( $id ) : boolean
$id
return boolean

removeService() public method

public removeService ( $id )

setDefinition() public method

Callback will be executed with $this (ServiceContainer) as a argument.
public setDefinition ( $id, Closure $definition, array $tags = [] )
$id
$definition Closure
$tags array

setParameter() public method

public setParameter ( $id, $value )
$id
$value

setStaticDefinition() public method

Works just like setDefinition but getService($id) is going to return exactly same value every single time.
public setStaticDefinition ( $id, Closure $definition, array $tags = [] )
$id
$definition Closure
$tags array