Browse Source

Fixed some errors given by phpmd

Marc 13 years ago
parent
commit
745d04cdf8
3 changed files with 12 additions and 6 deletions
  1. 2 2
      MmoreramerinoGearmanBundle.php
  2. 0 1
      Service/GearmanExecute.php
  3. 10 3
      Workers/testWorker.php

+ 2 - 2
MmoreramerinoGearmanBundle.php

@@ -35,11 +35,11 @@ class MmoreramerinoGearmanBundle extends GearmanBaseBundle
         $gearmanCache = $this->container->get('gearman.cache');
         $existsCache = $gearmanCache->existsCacheFile();
 
-        $environmentsCacheClear = array(
+        $cacheclearEnvs = array(
             'back_dev', 'back_test', 'dev', 'test',
         );
 
-        if (in_array($this->container->get('kernel')->getEnvironment(), $environmentsCacheClear) || !$existsCache) {
+        if (in_array($this->container->get('kernel')->getEnvironment(), $cacheclearEnvs) || !$existsCache) {
 
             if ($existsCache) {
                 $gearmanCache->emptyCache();

+ 0 - 1
Service/GearmanExecute.php

@@ -34,7 +34,6 @@ class GearmanExecute extends GearmanService
     private function callJob(Array $worker)
     {
         $gmworker= new \GearmanWorker();
-        $settings = $this->getSettings();
         $job = $worker['job'];
 
         if (is_array($job['servers'])) {

+ 10 - 3
Workers/testWorker.php

@@ -8,26 +8,33 @@ class testWorker
 
     /**
      * Test method to run as a job
-     * 
+     *
      * @param \GearmanJob $job Object with job parameters
      *
+     * @return boolean
+     *
      * @Gearman\Job(iterations=3, name="test", description="This is a description")     *
      */
     public function testA(\GearmanJob $job)
     {
-        echo get_class($job);die();
         echo 'Job testA done!'.PHP_EOL;
+
+        return true;
     }
 
     /**
      * Test method to run as a job
      *
      * @param \GearmanJob $job Object with job parameters
-     * 
+     *
+     * @return boolean
+     *
      * @Gearman\Job
      */
     public function testB(\GearmanJob $job)
     {
         echo 'Job testB done!'.PHP_EOL;
+
+        return true;
     }
 }