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 ();
2017-07-17 21:21:41 +01:00
private $privates = 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 ();
2017-07-17 21:21:41 +01:00
$this -> services = $this -> privates = array ();
2013-05-05 11:11:01 +01:00
$this -> methodMap = array (
2017-05-20 21:54:17 +01:00
'BAR' => 'getBARService' ,
'BAR2' => 'getBAR2Service' ,
'bar' => 'getBar3Service' ,
'bar2' => 'getBar22Service' ,
2013-05-05 11:11:01 +01:00
'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
}
2017-07-24 15:06:58 +01:00
/**
* { @ inheritdoc }
*/
public function reset ()
{
$this -> privates = array ();
parent :: reset ();
}
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
}
2017-05-20 21:54:17 +01:00
/**
2017-07-26 09:20:24 +01:00
* Gets the public 'BAR' shared service .
2017-05-20 21:54:17 +01:00
*
2017-07-26 09:20:24 +01:00
* @ return \stdClass
2017-05-20 21:54:17 +01:00
*/
protected function getBARService ()
{
$this -> services [ 'BAR' ] = $instance = new \stdClass ();
2017-07-17 21:21:41 +01:00
$instance -> bar = ( $this -> services [ 'bar' ] ? ? $this -> getBar3Service ());
2017-05-20 21:54:17 +01:00
return $instance ;
}
/**
2017-07-26 09:20:24 +01:00
* Gets the public 'BAR2' shared service .
2017-05-20 21:54:17 +01:00
*
2017-07-26 09:20:24 +01:00
* @ return \stdClass
2017-05-20 21:54:17 +01:00
*/
protected function getBAR2Service ()
{
return $this -> services [ 'BAR2' ] = new \stdClass ();
}
2013-01-05 08:50:11 +00:00
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'bar' shared service .
2013-01-05 08:50:11 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Bar\FooClass
2013-01-05 08:50:11 +00:00
*/
2017-05-20 21:54:17 +01:00
protected function getBar3Service ()
2013-01-05 08:50:11 +00:00
{
2017-07-17 21:21:41 +01:00
$a = ( $this -> services [ 'foo.baz' ] ? ? $this -> getFoo_BazService ());
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 ;
}
2017-05-20 21:54:17 +01:00
/**
2017-07-26 09:20:24 +01:00
* Gets the public 'bar2' shared service .
2017-05-20 21:54:17 +01:00
*
2017-07-26 09:20:24 +01:00
* @ return \stdClass
2017-05-20 21:54:17 +01:00
*/
protected function getBar22Service ()
{
return $this -> services [ 'bar2' ] = new \stdClass ();
}
2013-01-05 09:16:41 +00:00
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'baz' shared service .
2013-01-05 09:16:41 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Baz
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-07-17 21:21:41 +01:00
$instance -> setFoo (( $this -> services [ 'foo_with_inline' ] ? ? $this -> getFooWithInlineService ()));
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
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'configured_service' shared service .
2013-11-02 12:45:44 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \stdClass
2013-11-02 12:45:44 +00:00
*/
protected function getConfiguredServiceService ()
{
2015-03-23 18:17:24 +00:00
$a = new \ConfClass ();
2017-07-17 21:21:41 +01:00
$a -> setFoo (( $this -> services [ 'baz' ] ? ? $this -> getBazService ()));
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
/**
2017-07-26 08:58:16 +01:00
* Gets the public 'configured_service_simple' shared service .
2016-04-30 11:40:11 +01:00
*
2017-07-26 08:58:16 +01:00
* @ return \stdClass
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
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'decorator_service' shared service .
2014-03-31 16:58:40 +01:00
*
2017-07-26 08:27:50 +01:00
* @ return \stdClass
2014-03-31 16:58:40 +01:00
*/
protected function getDecoratorServiceService ()
{
return $this -> services [ 'decorator_service' ] = new \stdClass ();
}
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'decorator_service_with_name' shared service .
2014-03-31 16:58:40 +01:00
*
2017-07-26 08:27:50 +01:00
* @ return \stdClass
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
/**
2017-07-26 08:56:01 +01:00
* Gets the public 'deprecated_service' shared service .
2015-08-07 17:08:40 +01:00
*
2017-07-26 08:56:01 +01:00
* @ return \stdClass
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
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'factory_service' shared service .
2013-01-05 08:50:11 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Bar
2013-01-05 08:50:11 +00:00
*/
protected function getFactoryServiceService ()
{
2017-07-17 21:21:41 +01:00
return $this -> services [ 'factory_service' ] = ( $this -> services [ 'foo.baz' ] ? ? $this -> getFoo_BazService ()) -> getInstance ();
2013-01-05 08:50:11 +00:00
}
2016-04-30 11:40:11 +01:00
/**
2017-07-26 08:58:16 +01:00
* Gets the public 'factory_service_simple' shared service .
2016-04-30 11:40:11 +01:00
*
2017-07-26 08:58:16 +01:00
* @ return \Bar
2016-04-30 11:40:11 +01:00
*/
protected function getFactoryServiceSimpleService ()
{
2017-07-26 08:41:52 +01:00
return $this -> services [ 'factory_service_simple' ] = ( $this -> privates [ 'factory_simple' ] ? ? $this -> getFactorySimpleService ()) -> getInstance ();
2016-04-30 11:40:11 +01:00
}
2013-01-05 08:50:11 +00:00
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'foo' shared service .
2013-01-05 08:50:11 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Bar\FooClass
2013-01-05 08:50:11 +00:00
*/
protected function getFooService ()
{
2017-07-17 21:21:41 +01:00
$a = ( $this -> services [ 'foo.baz' ] ? ? $this -> getFoo_BazService ());
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-07-17 21:21:41 +01:00
$instance -> setBar (( $this -> services [ 'bar' ] ? ? $this -> getBar3Service ()));
2016-11-19 11:21:18 +00:00
$instance -> initialize ();
2013-01-05 08:50:11 +00:00
sc_configure ( $instance );
return $instance ;
}
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'foo.baz' shared service .
2013-01-05 08:50:11 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \BazClass
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 ;
}
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'foo_bar' service .
2013-01-05 08:50:11 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Bar\FooClass
2013-01-05 08:50:11 +00:00
*/
protected function getFooBarService ()
{
2017-08-07 19:06:09 +01:00
return new \Bar\FooClass (( $this -> services [ 'deprecated_service' ] ? ? $this -> getDeprecatedServiceService ()));
2013-01-05 08:50:11 +00:00
}
2013-01-05 08:13:52 +00:00
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'foo_with_inline' shared service .
2013-01-05 08:13:52 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Foo
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-07-17 21:21:41 +01:00
$a -> setBaz (( $this -> services [ 'baz' ] ? ? $this -> getBazService ()));
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
/**
2017-07-26 08:58:57 +01:00
* Gets the public 'lazy_context' shared service .
2016-12-13 17:37:51 +00:00
*
2017-07-26 08:58:57 +01:00
* @ return \LazyContext
2016-12-13 17:37:51 +00:00
*/
protected function getLazyContextService ()
{
2017-01-29 19:10:36 +00:00
return $this -> services [ 'lazy_context' ] = new \LazyContext ( new RewindableGenerator ( function () {
2017-07-17 21:21:41 +01:00
yield 'k1' => ( $this -> services [ 'foo.baz' ] ? ? $this -> getFoo_BazService ());
2017-04-21 10:31:17 +01:00
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
}
/**
2017-07-26 08:58:57 +01:00
* Gets the public 'lazy_context_ignore_invalid_ref' shared service .
2016-12-13 17:37:51 +00:00
*
2017-07-26 08:58:57 +01:00
* @ return \LazyContext
2016-12-13 17:37:51 +00:00
*/
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-07-17 21:21:41 +01:00
yield 0 => ( $this -> services [ 'foo.baz' ] ? ? $this -> getFoo_BazService ());
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
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'method_call1' shared service .
2013-01-05 08:50:11 +00:00
*
2017-07-26 08:27:50 +01:00
* @ return \Bar\FooClass
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-07-17 21:21:41 +01:00
$instance -> setBar (( $this -> services [ 'foo' ] ? ? $this -> getFooService ()));
2013-01-05 08:50:11 +00:00
$instance -> setBar ( NULL );
2017-07-26 07:59:36 +01:00
$instance -> setBar ((( $this -> services [ 'foo' ] ? ? $this -> getFooService ()) -> 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
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'new_factory_service' shared service .
2014-04-13 16:18:39 +01:00
*
2017-07-26 08:27:50 +01:00
* @ return \FooBarBaz
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
/**
2017-07-26 08:27:50 +01:00
* Gets the public 'service_from_static_method' shared service .
2014-09-27 17:06:30 +01:00
*
2017-07-26 08:27:50 +01:00
* @ return \Bar\FooClass
2014-09-27 17:06:30 +01:00
*/
protected function getServiceFromStaticMethodService ()
{
return $this -> services [ 'service_from_static_method' ] = \Bar\FooClass :: getInstance ();
}
2017-07-26 08:41:52 +01:00
/**
* Gets the private 'factory_simple' shared service .
*
* @ return \SimpleFactoryClass
*
* @ deprecated The " factory_simple " service is deprecated . You should stop using it , as it will soon be removed .
*/
2017-08-07 19:06:09 +01:00
protected function getFactorySimpleService ()
2017-07-26 08:41:52 +01:00
{
@ trigger_error ( 'The "factory_simple" service is deprecated. You should stop using it, as it will soon be removed.' , E_USER_DEPRECATED );
return $this -> privates [ 'factory_simple' ] = new \SimpleFactoryClass ( 'foo' );
}
2013-01-05 08:50:11 +00:00
/**
* { @ inheritdoc }
*/
public function getParameter ( $name )
{
2017-06-12 12:31:43 +01:00
if ( ! ( isset ( $this -> parameters [ $name ]) || isset ( $this -> loadedDynamicParameters [ $name ]) || array_key_exists ( $name , $this -> parameters ))) {
2017-08-12 10:16:19 +01:00
$name = $this -> normalizeParameterName ( $name );
2013-01-05 08:50:11 +00:00
2017-06-12 12:31:43 +01:00
if ( ! ( isset ( $this -> parameters [ $name ]) || isset ( $this -> loadedDynamicParameters [ $name ]) || array_key_exists ( $name , $this -> parameters ))) {
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 )
{
2017-08-12 10:16:19 +01:00
$name = $this -> normalizeParameterName ( $name );
2013-01-13 19:19:05 +00:00
2017-06-12 12:31:43 +01:00
return isset ( $this -> parameters [ $name ]) || isset ( $this -> loadedDynamicParameters [ $name ]) || array_key_exists ( $name , $this -> parameters );
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 ));
}
2017-08-12 10:16:19 +01:00
private $normalizedParameterNames = array ();
private function normalizeParameterName ( $name )
{
if ( isset ( $this -> normalizedParameterNames [ $normalizedName = strtolower ( $name )]) || isset ( $this -> parameters [ $normalizedName ]) || array_key_exists ( $normalizedName , $this -> parameters )) {
$normalizedName = isset ( $this -> normalizedParameterNames [ $normalizedName ]) ? $this -> normalizedParameterNames [ $normalizedName ] : $normalizedName ;
if (( string ) $name !== $normalizedName ) {
@ trigger_error ( sprintf ( 'Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since version 3.4.' , $name , $normalizedName ), E_USER_DEPRECATED );
}
} else {
$normalizedName = $this -> normalizedParameterNames [ $normalizedName ] = ( string ) $name ;
}
return $normalizedName ;
}
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' ,
);
}
}