PHP Interface Symfony\Component\DependencyInjection\ContainerInterface

Author: Fabien Potencier ([email protected])
Author: Johannes M. Schmitt ([email protected])
Show file Open project: pmjones/php-framework-benchmarks Interface Usage Examples

Public Methods

Method Description
addScope ( Symfony\Component\DependencyInjection\ScopeInterface $scope ) : void Adds a scope to the container
enterScope ( string $name ) : void Enters the given scope
get ( string $id, integer $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE ) : object Gets a service.
getParameter ( string $name ) : mixed Gets a parameter.
has ( string $id ) : boolean Returns true if the given service is defined.
hasParameter ( string $name ) : boolean Checks if a parameter exists.
hasScope ( string $name ) : boolean Whether this container has the given scope
isScopeActive ( string $name ) : boolean Determines whether the given scope is currently active.
leaveScope ( string $name ) : void Leaves the current scope, and re-enters the parent scope
set ( string $id, object $service, string $scope = self::SCOPE_CONTAINER ) Sets a service.
setParameter ( string $name, mixed $value ) Sets a parameter.

Method Details

addScope() public method

Adds a scope to the container
public addScope ( Symfony\Component\DependencyInjection\ScopeInterface $scope ) : void
$scope Symfony\Component\DependencyInjection\ScopeInterface
return void

enterScope() public method

Enters the given scope
public enterScope ( string $name ) : void
$name string
return void

get() public method

Gets a service.
See also: Reference
public get ( string $id, integer $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE ) : object
$id string The service identifier
$invalidBehavior integer The behavior when the service does not exist
return object The associated service

getParameter() public method

Gets a parameter.
public getParameter ( string $name ) : mixed
$name string The parameter name
return mixed The parameter value

has() public method

Returns true if the given service is defined.
public has ( string $id ) : boolean
$id string The service identifier
return boolean true if the service is defined, false otherwise

hasParameter() public method

Checks if a parameter exists.
public hasParameter ( string $name ) : boolean
$name string The parameter name
return boolean The presence of parameter in container

hasScope() public method

Whether this container has the given scope
public hasScope ( string $name ) : boolean
$name string
return boolean

isScopeActive() public method

It does however not check if the scope actually exists.
public isScopeActive ( string $name ) : boolean
$name string
return boolean

leaveScope() public method

Leaves the current scope, and re-enters the parent scope
public leaveScope ( string $name ) : void
$name string
return void

set() public method

Sets a service.
public set ( string $id, object $service, string $scope = self::SCOPE_CONTAINER )
$id string The service identifier
$service object The service instance
$scope string The scope of the service

setParameter() public method

Sets a parameter.
public setParameter ( string $name, mixed $value )
$name string The parameter name
$value mixed The parameter value