Bläddra i källkod

Solves #61. Only parses if there is any bundle to parse

mmoreram 11 år sedan
förälder
incheckning
dafd917e80
2 ändrade filer med 14 tillägg och 8 borttagningar
  1. 13 7
      Service/GearmanCacheWrapper.php
  2. 1 1
      Service/GearmanDescriber.php

+ 13 - 7
Service/GearmanCacheWrapper.php

@@ -232,15 +232,21 @@ class GearmanCacheWrapper
 
 
         $reader = new SimpleAnnotationReader();
         $reader = new SimpleAnnotationReader();
         $reader->addNamespace('Mmoreram\GearmanBundle\Driver');
         $reader->addNamespace('Mmoreram\GearmanBundle\Driver');
+        $workerCollection = new WorkerCollection;
+
+        if (!empty($this->paths)) {
 
 
-        $finder = new Finder();
-        $finder
-            ->files()
-            ->followLinks()
-            ->exclude($this->excludedPaths)
-            ->in($this->paths);
+            $finder = new Finder();
+            $finder
+                ->files()
+                ->followLinks()
+                ->exclude($this->excludedPaths)
+                ->in($this->paths);
 
 
-        return $this->parseFiles($finder, $reader);
+            $workerCollection = $this->parseFiles($finder, $reader);
+        }
+
+        return $workerCollection;
     }
     }
 
 
 
 

+ 1 - 1
Service/GearmanDescriber.php

@@ -63,7 +63,7 @@ class GearmanDescriber
         $output->writeln('<info>    @job\methodName : ' . $job['methodName'] . '</info>');
         $output->writeln('<info>    @job\methodName : ' . $job['methodName'] . '</info>');
         $output->writeln('<info>    @job\callableName : ' . $job['realCallableName'] . '</info>');
         $output->writeln('<info>    @job\callableName : ' . $job['realCallableName'] . '</info>');
 
 
-        if( $job['jobPrefix']) {
+        if ($job['jobPrefix']) {
             $output->writeln('<info>    @job\jobPrefix : ' . $job['jobPrefix'] . '</info>');
             $output->writeln('<info>    @job\jobPrefix : ' . $job['jobPrefix'] . '</info>');
         }
         }