PHP Class Newscoop\DependencyInjection\ContainerBuilder

Provides wrapper methods for symfony's Container.
Inheritance: extends Symfony\Component\DependencyInjection\Container
Show file Open project: sourcefabric/newscoop Class Usage Examples

Public Methods

Method Description
__construct ( array $options = [] ) Construct object.
getAliases ( ) : array Gets all defined aliases.
getService ( string $id ) : object Gets a service.
getServiceIds ( ) : array Gets all service ids.
hasService ( string $id ) : boolean Returns true if the given service is defined.
register ( string $id, string $class = null ) Registers a service definition.
setAlias ( string $alias, mixed $id ) Sets an alias for an existing service.
setService ( string $id, object $service ) Sets a service.

Method Details

__construct() public method

Construct object.
public __construct ( array $options = [] )
$options array The default options

getAliases() public method

Wrapper for ContainerBuilder::getAliases method.
public getAliases ( ) : array
return array An array of aliases

getService() public method

Wrapper for ContainerBuilder::get method.
public getService ( string $id ) : object
$id string The service identifier
return object The associated service

getServiceIds() public method

Wrapper for ContainerBuilder::getServiceIds method.
public getServiceIds ( ) : array
return array An array of all defined service ids

hasService() public method

Wrapper for ContainerBuilder::has method.
public hasService ( string $id ) : boolean
$id string The service identifier
return boolean True if the service is defined, false otherwise

register() public method

Wrapper for ContainerBuilder::getAliases method. This methods allows for simple registration of service definition with a fluid interface.
public register ( string $id, string $class = null )
$id string The service identifier
$class string The service class

setAlias() public method

Wrapper for ContainerBuilder::setAlias method.
public setAlias ( string $alias, mixed $id )
$alias string The alias to create
$id mixed The service to alias

setService() public method

Wrapper for ContainerBuilder::set method.
public setService ( string $id, object $service )
$id string The service identifier
$service object The service instance