Procházet zdrojové kódy

[AsseticBundle] rearranged execute() method

Kris Wallsmith před 14 roky
rodič
revize
9e19cac3c0

+ 10 - 8
src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php

@@ -51,13 +51,19 @@ class DumpCommand extends Command
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-        if ($input->getOption('watch')) {
-            return $this->watch($output);
+        if (!$input->getOption('watch')) {
+            foreach ($this->am->getNames() as $name) {
+                $this->dumpAsset($this->am->get($name), $output);
+            }
+
+            return;
         }
 
-        foreach ($this->am->getNames() as $name) {
-            $this->dumpAsset($this->am->get($name), $output);
+        if (!$this->debug) {
+            throw new \RuntimeException('The --watch option is only available in debug mode.');
         }
+
+        $this->watch($output);
     }
 
     /**
@@ -70,10 +76,6 @@ class DumpCommand extends Command
      */
     protected function watch(OutputInterface $output)
     {
-        if (!$this->debug) {
-            throw new \RuntimeException('The --watch option is only available in debug mode.');
-        }
-
         $refl = new \ReflectionClass('Assetic\\AssetManager');
         $prop = $refl->getProperty('assets');
         $prop->setAccessible(true);