This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Component/DependencyInjection/Fixtures/php/services_interfaces-2.php

68 lines
1.8 KiB
PHP
Raw Normal View History

<?php
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Parameter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
/**
* ProjectServiceContainer
*
* This class has been auto-generated
* by the Symfony Dependency Injection Component.
*/
class ProjectServiceContainer extends Container
{
/**
* Constructor.
*/
public function __construct()
{
parent::__construct(new ParameterBag($this->getDefaultParameters()));
}
/**
2011-01-26 23:14:31 +00:00
* Gets the 'bar' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
2011-01-26 23:14:31 +00:00
* @return Object An instance returned by barFactory::createBarClass().
*/
2011-01-26 23:14:31 +00:00
protected function getBarService()
{
2011-01-26 23:14:31 +00:00
return $this->services['bar'] = $this->get('barFactory')->createBarClass();
2011-02-27 20:14:03 +00:00
$this->applyInterfaceInjectors($instance);
}
/**
2011-01-26 23:14:31 +00:00
* Gets the 'barfactory' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
2011-01-26 23:14:31 +00:00
* @return BarClassFactory A BarClassFactory instance.
*/
2011-01-26 23:14:31 +00:00
protected function getBarfactoryService()
{
2011-01-26 23:14:31 +00:00
return $this->services['barfactory'] = new \BarClassFactory();
2011-02-27 20:14:03 +00:00
$this->applyInterfaceInjectors($instance);
}
/**
* Applies all known interface injection calls
*
* @param Object $instance
*/
2010-12-14 06:49:55 +00:00
protected function applyInterfaceInjectors($instance)
{
if ($instance instanceof \BarClass) {
$instance->setFoo('someValue');
}
}
}