X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fhttp-kernel%2FBundle%2FBundle.php;fp=vendor%2Fsymfony%2Fhttp-kernel%2FBundle%2FBundle.php;h=3b4e156c7a71615e91ac1bdf12fe49f3e481c7dc;hp=13c2d941d02f807f5a7ad32ce5e4b48a7acc4dc3;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/http-kernel/Bundle/Bundle.php b/vendor/symfony/http-kernel/Bundle/Bundle.php index 13c2d941d..3b4e156c7 100644 --- a/vendor/symfony/http-kernel/Bundle/Bundle.php +++ b/vendor/symfony/http-kernel/Bundle/Bundle.php @@ -11,7 +11,7 @@ namespace Symfony\Component\HttpKernel\Bundle; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\Console\Application; @@ -26,13 +26,12 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; */ abstract class Bundle implements BundleInterface { - /** - * @var ContainerInterface - */ - protected $container; + use ContainerAwareTrait; + protected $name; protected $extension; protected $path; + private $namespace; /** * Boots the Bundle. @@ -62,16 +61,6 @@ abstract class Bundle implements BundleInterface { } - /** - * Sets the container. - * - * @param ContainerInterface|null $container A ContainerInterface instance or null - */ - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - /** * Returns the bundle's container extension. * @@ -118,9 +107,11 @@ abstract class Bundle implements BundleInterface */ public function getNamespace() { - $class = get_class($this); + if (null === $this->namespace) { + $this->parseClassName(); + } - return substr($class, 0, strrpos($class, '\\')); + return $this->namespace; } /** @@ -154,14 +145,11 @@ abstract class Bundle implements BundleInterface */ final public function getName() { - if (null !== $this->name) { - return $this->name; + if (null === $this->name) { + $this->parseClassName(); } - $name = get_class($this); - $pos = strrpos($name, '\\'); - - return $this->name = false === $pos ? $name : substr($name, $pos + 1); + return $this->name; } /** @@ -230,4 +218,13 @@ abstract class Bundle implements BundleInterface return new $class(); } } + + private function parseClassName() + { + $pos = strrpos(static::class, '\\'); + $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos); + if (null === $this->name) { + $this->name = false === $pos ? static::class : substr(static::class, $pos + 1); + } + } }