2013-01-05 08:50:11 +00:00
< ? php
2016-12-13 17:37:51 +00:00
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator ;
2013-01-05 08:50:11 +00:00
use Symfony\Component\DependencyInjection\ContainerInterface ;
use Symfony\Component\DependencyInjection\Container ;
2013-01-05 15:29:42 +00:00
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException ;
use Symfony\Component\DependencyInjection\Exception\LogicException ;
use Symfony\Component\DependencyInjection\Exception\RuntimeException ;
2013-01-05 08:50:11 +00:00
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag ;
/**
2015-03-24 21:20:39 +00:00
* ProjectServiceContainer .
2013-01-05 08:50:11 +00:00
*
* This class has been auto - generated
* by the Symfony Dependency Injection Component .
2017-01-12 22:13:34 +00:00
*
* @ final since Symfony 3.3
2013-01-05 08:50:11 +00:00
*/
class ProjectServiceContainer extends Container
{
2014-12-03 08:59:38 +00:00
private $parameters ;
2014-12-04 20:13:58 +00:00
private $targetDirs = array ();
2013-12-01 06:04:55 +00:00
2013-01-05 08:50:11 +00:00
/**
* Constructor .
*/
public function __construct ()
{
$this -> parameters = $this -> getDefaultParameters ();
2015-09-04 20:54:37 +01:00
$this -> services = array ();
2013-05-05 11:11:01 +01:00
$this -> methodMap = array (
'bar' => 'getBarService' ,
'baz' => 'getBazService' ,
2013-11-02 12:45:44 +00:00
'configured_service' => 'getConfiguredServiceService' ,
2016-04-30 11:40:11 +01:00
'configured_service_simple' => 'getConfiguredServiceSimpleService' ,
2014-03-31 16:58:40 +01:00
'decorator_service' => 'getDecoratorServiceService' ,
'decorator_service_with_name' => 'getDecoratorServiceWithNameService' ,
2015-08-07 17:08:40 +01:00
'deprecated_service' => 'getDeprecatedServiceService' ,
2013-05-05 11:11:01 +01:00
'factory_service' => 'getFactoryServiceService' ,
2016-04-30 11:40:11 +01:00
'factory_service_simple' => 'getFactoryServiceSimpleService' ,
2013-05-05 11:11:01 +01:00
'foo' => 'getFooService' ,
'foo.baz' => 'getFoo_BazService' ,
'foo_bar' => 'getFooBarService' ,
'foo_with_inline' => 'getFooWithInlineService' ,
2016-12-13 17:37:51 +00:00
'lazy_context' => 'getLazyContextService' ,
'lazy_context_ignore_invalid_ref' => 'getLazyContextIgnoreInvalidRefService' ,
2013-05-05 11:11:01 +01:00
'method_call1' => 'getMethodCall1Service' ,
2014-04-13 16:18:39 +01:00
'new_factory_service' => 'getNewFactoryServiceService' ,
2014-09-27 17:06:30 +01:00
'service_from_static_method' => 'getServiceFromStaticMethodService' ,
2013-06-04 13:28:00 +01:00
);
$this -> aliases = array (
2013-06-05 10:51:05 +01:00
'alias_for_alias' => 'foo' ,
2013-06-04 13:28:00 +01:00
'alias_for_foo' => 'foo' ,
2014-03-31 16:58:40 +01:00
'decorated' => 'decorator_service_with_name' ,
2013-05-05 11:11:01 +01:00
);
2013-01-05 08:50:11 +00:00
}
2014-09-05 10:37:47 +01:00
/**
* { @ inheritdoc }
*/
public function compile ()
{
2016-08-19 13:18:08 +01:00
throw new LogicException ( 'You cannot compile a dumped container that was already compiled.' );
}
/**
* { @ inheritdoc }
*/
public function isCompiled ()
{
return true ;
2014-09-05 10:37:47 +01:00
}
2016-08-22 09:46:49 +01:00
/**
* { @ inheritdoc }
*/
public function isFrozen ()
{
2016-08-19 13:18:08 +01:00
@ trigger_error ( sprintf ( 'The %s() method is deprecated since version 3.3 and will be removed in 4.0. Use the isCompiled() method instead.' , __METHOD__ ), E_USER_DEPRECATED );
2016-08-22 09:46:49 +01:00
return true ;
}
2013-01-05 08:50:11 +00:00
/**
* Gets the 'bar' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Bar\FooClass A Bar\FooClass instance
2013-01-05 08:50:11 +00:00
*/
protected function getBarService ()
{
2017-01-07 11:45:28 +00:00
$a = $ {( $_ = isset ( $this -> services [ 'foo.baz' ]) ? $this -> services [ 'foo.baz' ] : $this -> get ( 'foo.baz' )) && false ? : '_' };
2013-01-05 08:50:11 +00:00
2013-12-18 17:52:54 +00:00
$this -> services [ 'bar' ] = $instance = new \Bar\FooClass ( 'foo' , $a , $this -> getParameter ( 'foo_bar' ));
2013-11-02 12:45:44 +00:00
$a -> configure ( $instance );
2013-01-05 08:50:11 +00:00
return $instance ;
}
2013-01-05 09:16:41 +00:00
/**
* Gets the 'baz' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Baz A Baz instance
2013-01-05 09:16:41 +00:00
*/
protected function getBazService ()
{
2017-02-16 22:39:07 +00:00
$this -> services [ 'baz' ] = $instance = new \Baz ();
2017-02-16 22:50:29 +00:00
$instance -> setFoo ( $ {( $_ = isset ( $this -> services [ 'foo_with_inline' ]) ? $this -> services [ 'foo_with_inline' ] : $this -> get ( 'foo_with_inline' )) && false ? : '_' });
2017-02-16 22:39:07 +00:00
return $instance ;
2013-01-05 09:16:41 +00:00
}
2013-11-02 12:45:44 +00:00
/**
* Gets the 'configured_service' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \stdClass A stdClass instance
2013-11-02 12:45:44 +00:00
*/
protected function getConfiguredServiceService ()
{
2015-03-23 18:17:24 +00:00
$a = new \ConfClass ();
2017-01-07 11:45:28 +00:00
$a -> setFoo ( $ {( $_ = isset ( $this -> services [ 'baz' ]) ? $this -> services [ 'baz' ] : $this -> get ( 'baz' )) && false ? : '_' });
2015-03-23 18:17:24 +00:00
2013-11-02 12:45:44 +00:00
$this -> services [ 'configured_service' ] = $instance = new \stdClass ();
2015-03-23 18:17:24 +00:00
$a -> configureStdClass ( $instance );
2013-11-02 12:45:44 +00:00
return $instance ;
}
2016-04-30 11:40:11 +01:00
/**
* Gets the 'configured_service_simple' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-29 06:40:45 +01:00
* @ return \stdClass A stdClass instance
2016-04-30 11:40:11 +01:00
*/
protected function getConfiguredServiceSimpleService ()
{
$this -> services [ 'configured_service_simple' ] = $instance = new \stdClass ();
( new \ConfClass ( 'bar' )) -> configureStdClass ( $instance );
return $instance ;
}
2014-03-31 16:58:40 +01:00
/**
* Gets the 'decorator_service' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \stdClass A stdClass instance
2014-03-31 16:58:40 +01:00
*/
protected function getDecoratorServiceService ()
{
return $this -> services [ 'decorator_service' ] = new \stdClass ();
}
/**
* Gets the 'decorator_service_with_name' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \stdClass A stdClass instance
2014-03-31 16:58:40 +01:00
*/
protected function getDecoratorServiceWithNameService ()
{
return $this -> services [ 'decorator_service_with_name' ] = new \stdClass ();
}
2015-08-07 17:08:40 +01:00
/**
* Gets the 'deprecated_service' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-29 06:31:50 +01:00
* @ return \stdClass A stdClass instance
2015-08-07 17:08:40 +01:00
*
2015-08-10 13:35:12 +01:00
* @ deprecated The " deprecated_service " service is deprecated . You should stop using it , as it will soon be removed .
2015-08-07 17:08:40 +01:00
*/
protected function getDeprecatedServiceService ()
{
2015-08-10 13:35:12 +01:00
@ trigger_error ( 'The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.' , E_USER_DEPRECATED );
2015-08-07 17:08:40 +01:00
return $this -> services [ 'deprecated_service' ] = new \stdClass ();
}
2013-01-05 08:50:11 +00:00
/**
* Gets the 'factory_service' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Bar A Bar instance
2013-01-05 08:50:11 +00:00
*/
protected function getFactoryServiceService ()
{
2017-01-07 11:45:28 +00:00
return $this -> services [ 'factory_service' ] = $ {( $_ = isset ( $this -> services [ 'foo.baz' ]) ? $this -> services [ 'foo.baz' ] : $this -> get ( 'foo.baz' )) && false ? : '_' } -> getInstance ();
2013-01-05 08:50:11 +00:00
}
2016-04-30 11:40:11 +01:00
/**
* Gets the 'factory_service_simple' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-29 06:40:45 +01:00
* @ return \Bar A Bar instance
2016-04-30 11:40:11 +01:00
*/
protected function getFactoryServiceSimpleService ()
{
return $this -> services [ 'factory_service_simple' ] = ( new \SimpleFactoryClass ( 'foo' )) -> getInstance ();
}
2013-01-05 08:50:11 +00:00
/**
* Gets the 'foo' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Bar\FooClass A Bar\FooClass instance
2013-01-05 08:50:11 +00:00
*/
protected function getFooService ()
{
2017-01-07 11:45:28 +00:00
$a = $ {( $_ = isset ( $this -> services [ 'foo.baz' ]) ? $this -> services [ 'foo.baz' ] : $this -> get ( 'foo.baz' )) && false ? : '_' };
2013-01-05 08:50:11 +00:00
2013-12-18 17:52:54 +00:00
$this -> services [ 'foo' ] = $instance = \Bar\FooClass :: getInstance ( 'foo' , $a , array ( 'bar' => 'foo is bar' , 'foobar' => 'bar' ), true , $this );
2013-01-05 08:50:11 +00:00
$instance -> foo = 'bar' ;
$instance -> moo = $a ;
2013-11-23 20:44:08 +00:00
$instance -> qux = array ( 'bar' => 'foo is bar' , 'foobar' => 'bar' );
2017-01-07 11:45:28 +00:00
$instance -> setBar ( $ {( $_ = isset ( $this -> services [ 'bar' ]) ? $this -> services [ 'bar' ] : $this -> get ( 'bar' )) && false ? : '_' });
2016-11-19 11:21:18 +00:00
$instance -> initialize ();
2013-01-05 08:50:11 +00:00
sc_configure ( $instance );
return $instance ;
}
/**
* Gets the 'foo.baz' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \BazClass A BazClass instance
2013-01-05 08:50:11 +00:00
*/
protected function getFoo_BazService ()
{
2013-12-18 14:16:42 +00:00
$this -> services [ 'foo.baz' ] = $instance = \BazClass :: getInstance ();
2013-01-05 08:50:11 +00:00
2013-12-18 14:16:42 +00:00
\BazClass :: configureStatic1 ( $instance );
2013-01-05 08:50:11 +00:00
return $instance ;
}
/**
* Gets the 'foo_bar' service .
*
2016-06-28 06:50:50 +01:00
* @ return \Bar\FooClass A Bar\FooClass instance
2013-01-05 08:50:11 +00:00
*/
protected function getFooBarService ()
{
2013-12-18 17:52:54 +00:00
return new \Bar\FooClass ();
2013-01-05 08:50:11 +00:00
}
2013-01-05 08:13:52 +00:00
/**
* Gets the 'foo_with_inline' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Foo A Foo instance
2013-01-05 08:13:52 +00:00
*/
protected function getFooWithInlineService ()
{
$a = new \Bar ();
2017-01-27 15:27:34 +00:00
$this -> services [ 'foo_with_inline' ] = $instance = new \Foo ();
2017-02-16 22:39:07 +00:00
$a -> pub = 'pub' ;
2017-02-16 22:50:29 +00:00
$a -> setBaz ( $ {( $_ = isset ( $this -> services [ 'baz' ]) ? $this -> services [ 'baz' ] : $this -> get ( 'baz' )) && false ? : '_' });
2017-02-16 22:39:07 +00:00
2013-01-05 08:13:52 +00:00
$instance -> setBar ( $a );
return $instance ;
}
2016-12-13 17:37:51 +00:00
/**
* Gets the 'lazy_context' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
* @ return \LazyContext A LazyContext instance
*/
protected function getLazyContextService ()
{
2017-01-29 19:10:36 +00:00
return $this -> services [ 'lazy_context' ] = new \LazyContext ( new RewindableGenerator ( function () {
2017-04-21 10:31:17 +01:00
yield 'k1' => $ {( $_ = isset ( $this -> services [ 'foo.baz' ]) ? $this -> services [ 'foo.baz' ] : $this -> get ( 'foo.baz' )) && false ? : '_' };
yield 'k2' => $this ;
2017-05-19 22:03:53 +01:00
}, 2 ), new RewindableGenerator ( function () {
return new \EmptyIterator ();
}, 0 ));
2016-12-13 17:37:51 +00:00
}
/**
* Gets the 'lazy_context_ignore_invalid_ref' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
* @ return \LazyContext A LazyContext instance
*/
protected function getLazyContextIgnoreInvalidRefService ()
{
2017-01-29 19:10:36 +00:00
return $this -> services [ 'lazy_context_ignore_invalid_ref' ] = new \LazyContext ( new RewindableGenerator ( function () {
2017-01-07 11:45:28 +00:00
yield 0 => $ {( $_ = isset ( $this -> services [ 'foo.baz' ]) ? $this -> services [ 'foo.baz' ] : $this -> get ( 'foo.baz' )) && false ? : '_' };
2017-05-19 22:03:53 +01:00
}, 1 ), new RewindableGenerator ( function () {
return new \EmptyIterator ();
}, 0 ));
2016-12-13 17:37:51 +00:00
}
2013-01-05 08:50:11 +00:00
/**
* Gets the 'method_call1' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Bar\FooClass A Bar\FooClass instance
2013-01-05 08:50:11 +00:00
*/
protected function getMethodCall1Service ()
{
require_once '%path%foo.php' ;
2013-12-18 17:52:54 +00:00
$this -> services [ 'method_call1' ] = $instance = new \Bar\FooClass ();
2013-01-05 08:50:11 +00:00
2017-01-07 11:45:28 +00:00
$instance -> setBar ( $ {( $_ = isset ( $this -> services [ 'foo' ]) ? $this -> services [ 'foo' ] : $this -> get ( 'foo' )) && false ? : '_' });
2013-01-05 08:50:11 +00:00
$instance -> setBar ( NULL );
2016-07-22 15:17:18 +01:00
$instance -> setBar (( $this -> get ( " foo " ) -> foo () . (( $this -> hasParameter ( " foo " )) ? ( $this -> getParameter ( " foo " )) : ( " default " ))));
2013-01-05 08:50:11 +00:00
return $instance ;
}
2014-04-13 16:18:39 +01:00
/**
* Gets the 'new_factory_service' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \FooBarBaz A FooBarBaz instance
2014-04-13 16:18:39 +01:00
*/
protected function getNewFactoryServiceService ()
{
2015-03-23 18:17:24 +00:00
$a = new \FactoryClass ();
$a -> foo = 'bar' ;
$this -> services [ 'new_factory_service' ] = $instance = $a -> getInstance ();
2014-04-13 16:18:39 +01:00
$instance -> foo = 'bar' ;
return $instance ;
}
2014-09-27 17:06:30 +01:00
/**
* Gets the 'service_from_static_method' service .
*
* This service is shared .
* This method always returns the same instance of the service .
*
2016-06-28 06:50:50 +01:00
* @ return \Bar\FooClass A Bar\FooClass instance
2014-09-27 17:06:30 +01:00
*/
protected function getServiceFromStaticMethodService ()
{
return $this -> services [ 'service_from_static_method' ] = \Bar\FooClass :: getInstance ();
}
2013-01-05 08:50:11 +00:00
/**
* { @ inheritdoc }
*/
public function getParameter ( $name )
{
$name = strtolower ( $name );
2016-08-12 19:34:27 +01:00
if ( ! ( isset ( $this -> parameters [ $name ]) || array_key_exists ( $name , $this -> parameters ) || isset ( $this -> loadedDynamicParameters [ $name ]))) {
2013-01-05 15:29:42 +00:00
throw new InvalidArgumentException ( sprintf ( 'The parameter "%s" must be defined.' , $name ));
2013-01-05 08:50:11 +00:00
}
2016-08-12 19:34:27 +01:00
if ( isset ( $this -> loadedDynamicParameters [ $name ])) {
return $this -> loadedDynamicParameters [ $name ] ? $this -> dynamicParameters [ $name ] : $this -> getDynamicParameter ( $name );
}
2013-01-05 08:50:11 +00:00
2014-12-03 08:59:38 +00:00
return $this -> parameters [ $name ];
2013-01-05 08:50:11 +00:00
}
/**
* { @ inheritdoc }
*/
public function hasParameter ( $name )
{
2013-01-13 19:19:05 +00:00
$name = strtolower ( $name );
2016-08-12 19:34:27 +01:00
return isset ( $this -> parameters [ $name ]) || array_key_exists ( $name , $this -> parameters ) || isset ( $this -> loadedDynamicParameters [ $name ]);
2013-01-05 08:50:11 +00:00
}
/**
* { @ inheritdoc }
*/
public function setParameter ( $name , $value )
{
2013-01-05 15:29:42 +00:00
throw new LogicException ( 'Impossible to call set() on a frozen ParameterBag.' );
2013-01-05 08:50:11 +00:00
}
/**
2014-04-15 06:57:34 +01:00
* { @ inheritdoc }
2013-01-05 08:50:11 +00:00
*/
public function getParameterBag ()
{
if ( null === $this -> parameterBag ) {
2016-08-12 19:34:27 +01:00
$parameters = $this -> parameters ;
foreach ( $this -> loadedDynamicParameters as $name => $loaded ) {
$parameters [ $name ] = $loaded ? $this -> dynamicParameters [ $name ] : $this -> getDynamicParameter ( $name );
}
$this -> parameterBag = new FrozenParameterBag ( $parameters );
2013-01-05 08:50:11 +00:00
}
return $this -> parameterBag ;
}
2014-12-12 16:21:40 +00:00
2016-08-12 19:34:27 +01:00
private $loadedDynamicParameters = array ();
private $dynamicParameters = array ();
/**
* Computes a dynamic parameter .
*
* @ param string The name of the dynamic parameter to load
*
* @ return mixed The value of the dynamic parameter
*
* @ throws InvalidArgumentException When the dynamic parameter does not exist
*/
private function getDynamicParameter ( $name )
{
throw new InvalidArgumentException ( sprintf ( 'The dynamic parameter "%s" must be defined.' , $name ));
}
2013-01-05 08:50:11 +00:00
/**
* Gets the default parameters .
*
* @ return array An array of the default parameters
*/
protected function getDefaultParameters ()
{
return array (
'baz_class' => 'BazClass' ,
2013-12-18 17:52:54 +00:00
'foo_class' => 'Bar\\FooClass' ,
2013-01-05 08:50:11 +00:00
'foo' => 'bar' ,
);
}
}