Просмотр исходного кода

Updated code style, using phpcs as defined in documentation

Marc 11 лет назад
Родитель
Сommit
fc910bb12e

+ 2 - 1
Command/GearmanWorkerListCommand.php

@@ -61,7 +61,8 @@ class GearmanWorkerListCommand extends ContainerAwareCommand
                     $output->writeln('<comment>          name: '.$job['methodName'].'</comment>');
                     $output->writeln('<comment>          callablename:</comment><info> '.$job['realCallableNameNoPrefix'].'</info>');
 
-                    if(false === is_null($job['jobPrefix'])){
+                    if (false === is_null($job['jobPrefix'])) {
+
                         $output->writeln('<comment>          job prefix:</comment><info> '.$job['jobPrefix'].'</info>');
                     }
                 }

+ 4 - 7
Module/JobClass.php

@@ -121,13 +121,10 @@ class JobClass extends ContainerAware
 
         $this->methodName = $reflectionMethod->getName();
         $this->realCallableNameNoPrefix = str_replace('\\', '', $callableNameClass . '~' . $this->callableName);
-        
-        if(true === isset($defaultSettings['jobPrefix'])){
-            $this->jobPrefix = $defaultSettings['jobPrefix'];
-        }
-        else{
-            $this->jobPrefix = null;
-        }
+
+        $this->jobPrefix    = isset($defaultSettings['jobPrefix'])
+                            ? $defaultSettings['jobPrefix']
+                            : null;
 
         $this->realCallableName = $this->jobPrefix . $this->realCallableNameNoPrefix;
         $this->description  = is_null($jobAnnotation->description)

+ 3 - 2
Module/WorkerClass.php

@@ -156,8 +156,10 @@ class WorkerClass
         $this->className = $reflectionClass->getName();
         $this->service = $workAnnotation->service;
 
-        if(isset($defaultSettings['job_prefix']))
+        if (isset($defaultSettings['job_prefix'])) {
+
             $this->jobPrefix = $defaultSettings['job_prefix'];
+        }
 
         $this->servers = $this->loadServers($workAnnotation, $servers);
         $this->iterations = $this->loadIterations($workAnnotation, $defaultSettings);
@@ -181,7 +183,6 @@ class WorkerClass
      */
     private function loadServers(WorkAnnotation $workAnnotation, array $servers)
     {
-
         /**
          * If is configured some servers definition in the worker, overwrites
          */

+ 5 - 4
Service/Abstracts/AbstractGearmanService.php

@@ -41,15 +41,16 @@ abstract class AbstractGearmanService
      * Construct method
      *
      * @param GearmanCacheWrapper $gearmanCacheWrapper GearmanCacheWrapper
-     * @param array $defaultSettings The default settings for the bundle.
-     *
+     * @param array               $defaultSettings     The default settings for the bundle
      */
-    public function __construct(GearmanCacheWrapper $gearmanCacheWrapper,array $defaultSettings)
+    public function __construct(GearmanCacheWrapper $gearmanCacheWrapper, array $defaultSettings)
     {
         $this->workers = $gearmanCacheWrapper->getWorkers();
 
-        if(isset($defaultSettings['job_prefix']))
+        if (isset($defaultSettings['job_prefix'])) {
+
             $this->jobPrefix = $defaultSettings['job_prefix'];
+        }
     }
 
 

+ 6 - 5
Service/GearmanDescriber.php

@@ -124,17 +124,18 @@ class GearmanDescriber
         }
 
         $output->writeln('<info>    @worker\iterations : ' . $worker['iterations'] . '</info>');
-        $output->writeln('<info>    @Worker\#jobs : '.count($worker['jobs']).'</info>');
+        $output->writeln('<info>    @Worker\#jobs : ' . count($worker['jobs']) . '</info>');
 
         if ($tinyJobDescription) {
             $output->writeln('<info>    @Worker\jobs</info>');
             $output->writeln('');
             foreach ($worker['jobs'] as $job) {
 
-                if(false === is_null($job['jobPrefix'])){
-                    $output->writeln('<comment>        # ' . $job['realCallableNameNoPrefix'] . ' with prefix: '.$job['jobPrefix'].'</comment>');
-                }
-                else{
+                if ($job['jobPrefix']) {
+
+                    $output->writeln('<comment>        # ' . $job['realCallableNameNoPrefix'] . ' with prefix: ' . $job['jobPrefix'] . '</comment>');
+                } else {
+
                     $output->writeln('<comment>        # ' . $job['realCallableNameNoPrefix'] . ' </comment>');
                 }