PHP Class Go\Core\Container

Datei anzeigen Open project: goaop/framework Class Usage Examples

Protected Properties

Property Type Description
$tags array Store identifiers os services by tags
$values array List of services in the container

Public Methods

Method Description
get ( string $id ) : mixed Return a service or value from the container
getByTag ( string $tag ) : array Return list of service tagged with marker
has ( string $id ) : boolean Checks if item with specified id is present in the container
set ( string $id, mixed $value, array $tags = [] ) Set a service into the container
share ( string $id, callable $value, array $tags = [] ) Set a shared value in the container

Method Details

get() public method

Return a service or value from the container
public get ( string $id ) : mixed
$id string Identifier
return mixed

getByTag() public method

Return list of service tagged with marker
public getByTag ( string $tag ) : array
$tag string Tag to select
return array

has() public method

Checks if item with specified id is present in the container
public has ( string $id ) : boolean
$id string Identifier
return boolean

set() public method

Set a service into the container
public set ( string $id, mixed $value, array $tags = [] )
$id string Identifier
$value mixed Value to store
$tags array Additional tags

share() public method

Set a shared value in the container
public share ( string $id, callable $value, array $tags = [] )
$id string Identifier
$value callable Value to store
$tags array Additional tags

Property Details

$tags protected_oe property

Store identifiers os services by tags
protected array $tags
return array

$values protected_oe property

List of services in the container
protected array $values
return array