[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ -> Container.php (summary)

(no description)

File Size: 547 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Container:: (19 methods):
  __construct()
  compile()
  isFrozen()
  getParameterBag()
  getParameter()
  hasParameter()
  setParameter()
  set()
  has()
  get()
  initialized()
  getServiceIds()
  enterScope()
  leaveScope()
  addScope()
  hasScope()
  isScopeActive()
  camelize()
  underscore()


Class: Container  - X-Ref

Container is a dependency injection container.

It gives access to object instances (services).

Services and parameters are simple key/pair stores.

Parameter and service keys are case insensitive.

A service id can contain lowercased letters, digits, underscores, and dots.
Underscores are used to separate words, and dots to group services
under namespaces:

<ul>
<li>request</li>
<li>mysql_session_storage</li>
<li>symfony.mysql_session_storage</li>
</ul>

A service can also be defined by creating a method named
getXXXService(), where XXX is the camelized version of the id:

<ul>
<li>request -> getRequestService()</li>
<li>mysql_session_storage -> getMysqlSessionStorageService()</li>
<li>symfony.mysql_session_storage -> getSymfony_MysqlSessionStorageService()</li>
</ul>

The container can have three possible behaviors when a service does not exist:

* EXCEPTION_ON_INVALID_REFERENCE: Throws an exception (the default)
* NULL_ON_INVALID_REFERENCE:      Returns null
* IGNORE_ON_INVALID_REFERENCE:    Ignores the wrapping command asking for the reference
(for instance, ignore a setter if the service does not exist)

__construct(ParameterBagInterface $parameterBag = null)   X-Ref

param: ParameterBagInterface $parameterBag A ParameterBagInterface instance

compile()   X-Ref
Compiles the container.

This method does two things:

* Parameter values are resolved;
* The parameter bag is frozen.

isFrozen()   X-Ref
Returns true if the container parameter bag are frozen.

return: bool true if the container parameter bag are frozen, false otherwise

getParameterBag()   X-Ref
Gets the service container parameter bag.

return: ParameterBagInterface A ParameterBagInterface instance

getParameter($name)   X-Ref
Gets a parameter.

param: string $name The parameter name
return: mixed The parameter value

hasParameter($name)   X-Ref
Checks if a parameter exists.

param: string $name The parameter name
return: bool The presence of parameter in container

setParameter($name, $value)   X-Ref
Sets a parameter.

param: string $name  The parameter name
param: mixed  $value The parameter value

set($id, $service, $scope = self::SCOPE_CONTAINER)   X-Ref
Sets a service.

Setting a service to null resets the service: has() returns false and get()
behaves in the same way as if the service was never created.

param: string $id      The service identifier
param: object $service The service instance
param: string $scope   The scope of the service

has($id)   X-Ref
Returns true if the given service is defined.

param: string $id The service identifier
return: bool true if the service is defined, false otherwise

get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE)   X-Ref
Gets a service.

If a service is defined both through a set() method and
with a get{$id}Service() method, the former has always precedence.

param: string $id              The service identifier
param: int    $invalidBehavior The behavior when the service does not exist
return: object The associated service

initialized($id)   X-Ref
Returns true if the given service has actually been initialized.

param: string $id The service identifier
return: bool true if service has already been initialized, false otherwise

getServiceIds()   X-Ref
Gets all service ids.

return: array An array of all defined service ids

enterScope($name)   X-Ref
This is called when you enter a scope.

param: string $name

leaveScope($name)   X-Ref
This is called to leave the current scope, and move back to the parent
scope.

param: string $name The name of the scope to leave

addScope(ScopeInterface $scope)   X-Ref
Adds a scope to the container.

param: ScopeInterface $scope

hasScope($name)   X-Ref
Returns whether this container has a certain scope.

param: string $name The name of the scope
return: bool

isScopeActive($name)   X-Ref
Returns whether this scope is currently active.

This does not actually check if the passed scope actually exists.

param: string $name
return: bool

camelize($id)   X-Ref
Camelizes a string.

param: string $id A string to camelize
return: string The camelized string

underscore($id)   X-Ref
A string to underscore.

param: string $id The string to underscore
return: string The underscored string



Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1