Explorar o código

removed Kernel::isBooted() method

Fabien Potencier %!s(int64=14) %!d(string=hai) anos
pai
achega
09aeb78634

+ 0 - 3
src/Symfony/Bundle/DoctrineBundle/Tests/Command/InfoDoctrineCommandTest.php

@@ -22,9 +22,6 @@ class InfoDoctrineCommandTest extends TestCase
 
         $testContainer = $this->createYamlBundleTestContainer();
         $kernel = $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false);
-        $kernel->expects($this->once())
-               ->method('isBooted')
-               ->will($this->returnValue( true ));
         $kernel->expects($this->once())
                ->method('getBundles')
                ->will($this->returnValue(array()));

+ 1 - 3
src/Symfony/Bundle/FrameworkBundle/Cache/Cache.php

@@ -48,9 +48,7 @@ abstract class Cache extends BaseCache
      */
     protected function forward(Request $request, $raw = false, Response $entry = null)
     {
-        if (!$this->kernel->isBooted()) {
-            $this->kernel->boot();
-        }
+        $this->kernel->boot();
         $this->kernel->getContainer()->set('cache', $this);
         $this->kernel->getContainer()->set('esi', $this->esi);
 

+ 1 - 3
src/Symfony/Bundle/FrameworkBundle/Console/Application.php

@@ -37,9 +37,7 @@ class Application extends BaseApplication
 
         $this->definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
 
-        if (!$this->kernel->isBooted()) {
-            $this->kernel->boot();
-        }
+        $this->kernel->boot();
 
         $this->registerCommands();
     }

+ 4 - 13
src/Symfony/Component/HttpKernel/Kernel.php

@@ -29,8 +29,9 @@ use Symfony\Component\HttpKernel\ClassCollectionLoader;
 use Symfony\Component\HttpKernel\Bundle\BundleInterface;
 
 /**
- * The Kernel is the heart of the Symfony system. It manages an environment
- * that can host bundles.
+ * The Kernel is the heart of the Symfony system.
+ *
+ * It manages an environment made of bundles.
  *
  * @author Fabien Potencier <fabien.potencier@symfony-project.org>
  */
@@ -105,16 +106,6 @@ abstract class Kernel implements HttpKernelInterface, \Serializable
      */
     abstract public function registerContainerConfiguration(LoaderInterface $loader);
 
-    /**
-     * Checks whether the current kernel has been booted or not.
-     *
-     * @return Boolean $booted
-     */
-    public function isBooted()
-    {
-        return $this->booted;
-    }
-
     /**
      * Boots the current kernel.
      *
@@ -126,7 +117,7 @@ abstract class Kernel implements HttpKernelInterface, \Serializable
     public function boot()
     {
         if (true === $this->booted) {
-            throw new \LogicException('The kernel is already booted.');
+            return;
         }
 
         require_once __DIR__.'/bootstrap.php';