2010-10-02 15:47:35 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
|
|
|
use Symfony\Component\DependencyInjection\Container;
|
2011-03-14 20:12:42 +00:00
|
|
|
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
|
2010-10-02 15:47:35 +01:00
|
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
use Symfony\Component\DependencyInjection\Parameter;
|
2011-01-30 14:06:45 +00:00
|
|
|
|
2010-10-02 15:47:35 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ProjectServiceContainer
|
|
|
|
*
|
|
|
|
* This class has been auto-generated
|
|
|
|
* by the Symfony Dependency Injection Component.
|
|
|
|
*/
|
2011-01-17 10:40:04 +00:00
|
|
|
class ProjectServiceContainer extends Container
|
2010-10-02 15:47:35 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
2011-01-30 14:06:45 +00:00
|
|
|
$this->parameters = $this->getDefaultParameters();
|
|
|
|
|
|
|
|
$this->services =
|
|
|
|
$this->scopedServices =
|
|
|
|
$this->scopeStacks = array();
|
|
|
|
|
|
|
|
$this->set('service_container', $this);
|
|
|
|
|
|
|
|
$this->scopes = array();
|
|
|
|
$this->scopeChildren = array();
|
2010-10-02 15:47:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the 'foo' service.
|
|
|
|
*
|
|
|
|
* This service is shared.
|
|
|
|
* This method always returns the same instance of the service.
|
|
|
|
*
|
|
|
|
* @return FooClass A FooClass instance.
|
|
|
|
*/
|
|
|
|
protected function getFooService()
|
|
|
|
{
|
|
|
|
$this->services['foo'] = $instance = new \FooClass();
|
2011-01-05 11:13:27 +00:00
|
|
|
|
2010-10-02 15:47:35 +01:00
|
|
|
$instance->setBar('someValue');
|
|
|
|
|
|
|
|
return $instance;
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:06:45 +00:00
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function getParameter($name)
|
|
|
|
{
|
|
|
|
$name = strtolower($name);
|
|
|
|
|
|
|
|
if (!array_key_exists($name, $this->parameters)) {
|
|
|
|
throw new \InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->parameters[$name];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function hasParameter($name)
|
|
|
|
{
|
|
|
|
return array_key_exists(strtolower($name), $this->parameters);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function setParameter($name, $value)
|
|
|
|
{
|
|
|
|
throw new \LogicException('Impossible to call set() on a frozen ParameterBag.');
|
|
|
|
}
|
2010-10-02 15:47:35 +01:00
|
|
|
/**
|
|
|
|
* Gets the default parameters.
|
|
|
|
*
|
|
|
|
* @return array An array of the default parameters
|
|
|
|
*/
|
|
|
|
protected function getDefaultParameters()
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'cla' => 'Fo',
|
|
|
|
'ss' => 'Class',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|