Procházet zdrojové kódy

updated bootstrap file

Fabien Potencier před 14 roky
rodič
revize
1583c8b9ef
1 změnil soubory, kde provedl 10 přidání a 1 odebrání
  1. 10 1
      src/Symfony/Component/HttpKernel/bootstrap.php

+ 10 - 1
src/Symfony/Component/HttpKernel/bootstrap.php

@@ -3,11 +3,11 @@ namespace Symfony\Component\HttpKernel\Bundle
 {
 use Symfony\Component\DependencyInjection\ContainerAware;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
 use Symfony\Component\Console\Application;
 use Symfony\Component\Finder\Finder;
 abstract class Bundle extends ContainerAware implements BundleInterface
 {
+    protected $name;
     public function boot()
     {
     }
@@ -18,6 +18,14 @@ abstract class Bundle extends ContainerAware implements BundleInterface
     {
         return null;
     }
+    final public function getName()
+    {
+        if (null !== $this->name) {
+            return $this->name;
+        }
+        $pos = strrpos(get_class($this), '\\');
+        return $this->name = substr(get_class($this), $pos ? $pos + 1 : 0);
+    }
     public function registerExtensions(ContainerBuilder $container)
     {
         if (!$dir = realpath($this->getPath().'/DependencyInjection')) {
@@ -55,6 +63,7 @@ interface BundleInterface
     function boot();
     function shutdown();
     function getParent();
+    function getName();
     function getNamespace();
     function getPath();
 }