X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fsymfony%2Fdependency-injection%2FTests%2FFixtures%2Fphp%2Fservices9_compiled.php;fp=vendor%2Fsymfony%2Fdependency-injection%2FTests%2FFixtures%2Fphp%2Fservices9_compiled.php;h=4680b6e853b9c8154af0d7d2ceae7f281db049d8;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=817bdaaaac21f4bc6ce3a2b85081243a69ea7bcb;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php index 817bdaaaa..4680b6e85 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php @@ -2,7 +2,6 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\DependencyInjection\Exception\InactiveScopeException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\LogicException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; @@ -26,19 +25,17 @@ class ProjectServiceContainer extends Container { $this->parameters = $this->getDefaultParameters(); - $this->services = - $this->scopedServices = - $this->scopeStacks = array(); - $this->scopes = array(); - $this->scopeChildren = array(); + $this->services = array(); $this->methodMap = array( 'bar' => 'getBarService', 'baz' => 'getBazService', 'configured_service' => 'getConfiguredServiceService', + 'configured_service_simple' => 'getConfiguredServiceSimpleService', 'decorator_service' => 'getDecoratorServiceService', 'decorator_service_with_name' => 'getDecoratorServiceWithNameService', 'deprecated_service' => 'getDeprecatedServiceService', 'factory_service' => 'getFactoryServiceService', + 'factory_service_simple' => 'getFactoryServiceSimpleService', 'foo' => 'getFooService', 'foo.baz' => 'getFoo_BazService', 'foo_bar' => 'getFooBarService', @@ -72,12 +69,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'bar' service. + * Gets the public 'bar' shared service. * - * This service is shared. - * This method always returns the same instance of the service. - * - * @return \Bar\FooClass A Bar\FooClass instance + * @return \Bar\FooClass */ protected function getBarService() { @@ -91,12 +85,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'baz' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'baz' shared service. * - * @return \Baz A Baz instance + * @return \Baz */ protected function getBazService() { @@ -108,12 +99,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'configured_service' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'configured_service' shared service. * - * @return \stdClass A stdClass instance + * @return \stdClass */ protected function getConfiguredServiceService() { @@ -128,12 +116,23 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'decorator_service' service. + * Gets the public 'configured_service_simple' shared service. * - * This service is shared. - * This method always returns the same instance of the service. + * @return \stdClass + */ + protected function getConfiguredServiceSimpleService() + { + $this->services['configured_service_simple'] = $instance = new \stdClass(); + + (new \ConfClass('bar'))->configureStdClass($instance); + + return $instance; + } + + /** + * Gets the public 'decorator_service' shared service. * - * @return \stdClass A stdClass instance + * @return \stdClass */ protected function getDecoratorServiceService() { @@ -141,12 +140,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'decorator_service_with_name' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'decorator_service_with_name' shared service. * - * @return \stdClass A stdClass instance + * @return \stdClass */ protected function getDecoratorServiceWithNameService() { @@ -154,12 +150,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'deprecated_service' service. + * Gets the public 'deprecated_service' shared service. * - * This service is shared. - * This method always returns the same instance of the service. - * - * @return \stdClass A stdClass instance + * @return \stdClass * * @deprecated The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed. */ @@ -171,12 +164,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'factory_service' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'factory_service' shared service. * - * @return \Bar A Bar instance + * @return \Bar */ protected function getFactoryServiceService() { @@ -184,12 +174,19 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'foo' service. + * Gets the public 'factory_service_simple' shared service. * - * This service is shared. - * This method always returns the same instance of the service. + * @return \Bar + */ + protected function getFactoryServiceSimpleService() + { + return $this->services['factory_service_simple'] = (new \SimpleFactoryClass('foo'))->getInstance(); + } + + /** + * Gets the public 'foo' shared service. * - * @return \Bar\FooClass A Bar\FooClass instance + * @return \Bar\FooClass */ protected function getFooService() { @@ -208,12 +205,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'foo.baz' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'foo.baz' shared service. * - * @return \BazClass A BazClass instance + * @return \BazClass */ protected function getFoo_BazService() { @@ -225,9 +219,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'foo_bar' service. + * Gets the public 'foo_bar' service. * - * @return \Bar\FooClass A Bar\FooClass instance + * @return \Bar\FooClass */ protected function getFooBarService() { @@ -235,12 +229,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'foo_with_inline' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'foo_with_inline' shared service. * - * @return \Foo A Foo instance + * @return \Foo */ protected function getFooWithInlineService() { @@ -257,12 +248,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'method_call1' service. + * Gets the public 'method_call1' shared service. * - * This service is shared. - * This method always returns the same instance of the service. - * - * @return \Bar\FooClass A Bar\FooClass instance + * @return \Bar\FooClass */ protected function getMethodCall1Service() { @@ -272,18 +260,15 @@ class ProjectServiceContainer extends Container $instance->setBar($this->get('foo')); $instance->setBar(NULL); - $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + $instance->setBar(($this->get('foo')->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); return $instance; } /** - * Gets the 'new_factory_service' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'new_factory_service' shared service. * - * @return \FooBarBaz A FooBarBaz instance + * @return \FooBarBaz */ protected function getNewFactoryServiceService() { @@ -298,10 +283,7 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'request' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'request' shared service. * * @throws RuntimeException always since this service is expected to be injected dynamically */ @@ -311,12 +293,9 @@ class ProjectServiceContainer extends Container } /** - * Gets the 'service_from_static_method' service. - * - * This service is shared. - * This method always returns the same instance of the service. + * Gets the public 'service_from_static_method' shared service. * - * @return \Bar\FooClass A Bar\FooClass instance + * @return \Bar\FooClass */ protected function getServiceFromStaticMethodService() { @@ -330,9 +309,12 @@ class ProjectServiceContainer extends Container { $name = strtolower($name); - if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters))) { + if (!(isset($this->parameters[$name]) || array_key_exists($name, $this->parameters) || isset($this->loadedDynamicParameters[$name]))) { throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); } + if (isset($this->loadedDynamicParameters[$name])) { + return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); + } return $this->parameters[$name]; } @@ -344,7 +326,7 @@ class ProjectServiceContainer extends Container { $name = strtolower($name); - return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters); + return isset($this->parameters[$name]) || array_key_exists($name, $this->parameters) || isset($this->loadedDynamicParameters[$name]); } /** @@ -361,12 +343,33 @@ class ProjectServiceContainer extends Container public function getParameterBag() { if (null === $this->parameterBag) { - $this->parameterBag = new FrozenParameterBag($this->parameters); + $parameters = $this->parameters; + foreach ($this->loadedDynamicParameters as $name => $loaded) { + $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); + } + $this->parameterBag = new FrozenParameterBag($parameters); } return $this->parameterBag; } + 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)); + } + /** * Gets the default parameters. *