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

Fixing some files for refactoring

Marc 12 лет назад
Родитель
Сommit
9c59b848c9

+ 5 - 2
Command/GearmanCacheClearCommand.php

@@ -48,7 +48,10 @@ class GearmanCacheClearCommand extends ContainerAwareCommand
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         $output->writeln('Clearing the cache for the ' . $this->getContainer()->get('kernel')->getEnvironment() . ' environment');
-        $gearmanCache = $this->getContainer()->get('gearman.cache');
-        $gearmanCache->emptyCache();
+
+        $this
+            ->getContainer()
+            ->get('@liip_doctrine_cache.ns.gearman')
+            ->delete($this->getContainer()->getParameter('gearman.cache.id'));
     }
 }

+ 7 - 5
Command/GearmanCacheWarmupCommand.php

@@ -32,7 +32,7 @@ class GearmanCacheWarmupCommand extends ContainerAwareCommand
         
         $this   ->setName('gearman:cache:warmup')
                 ->setAliases(array('cache:gearman:warmup'))
-                ->setDescription('Warm ups gearman cache data on current environment');
+                ->setDescription('Warms up gearman cache data');
     }
 
     /**
@@ -48,9 +48,11 @@ class GearmanCacheWarmupCommand extends ContainerAwareCommand
     protected function execute(InputInterface $input, OutputInterface $output)
     {
         $output->writeln('Warming up the cache for the ' . $this->getContainer()->get('kernel')->getEnvironment() . ' environment');
-        $gearmanCache = $this->getContainer()->get('gearman.cache');
-        $gearmanCache->emptyCache();
-        $gearmanCacheLoader = $this->getContainer()->get('gearman.cache.loader');
-        $gearmanCacheLoader->load($gearmanCache);
+
+        $this
+            ->getContainer()
+            ->get('@gearman.cache.wrapper')
+            ->flush()
+            ->load();
     }
 }

+ 0 - 54
Command/GearmanCheckCommand.php

@@ -1,54 +0,0 @@
-<?php
-
-namespace Mmoreram\GearmanBundle\Command;
-
-use Symfony\Component\Console\Input\InputOption;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputDefinition;
-use Symfony\Component\Console\Output\OutputInterface;
-use Mmoreram\GearmanBundle\Service\GearmanSettings;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
-use Mmoreram\GearmanBundle\Exceptions\GearmanNotInstalledException;
-use Mmoreram\GearmanBundle\Exceptions\NoSettingsFileExistsException;
-
-/**
- * Checks gearman environment
- *
- * @author Marc Morera <yuhu@mmoreram.com>
- */
-class GearmanCheckCommand extends ContainerAwareCommand
-{
-    /**
-     * Console Command configuration
-     */
-    protected function configure()
-    {
-        parent::configure();
-
-        $this->setName('gearman:check')
-             ->setDescription('Checks gearman environment');
-    }
-
-    /**
-     * Executes the current command.
-     *
-     * @param InputInterface  $input  An InputInterface instance
-     * @param OutputInterface $output An OutputInterface instance
-     *
-     * @return integer 0 if everything went fine, or an error code
-     *
-     * @throws \LogicException When this abstract class is not implemented
-     */
-    protected function execute(InputInterface $input, OutputInterface $output)
-    {
-        $gearmanSettings = $this->getContainer()->get('gearman.settings');
-        if (!$gearmanSettings->existsSettings()) {
-            throw new NoSettingsFileExistsException($this->getFilePath());
-        } else {
-            $output->writeln('<comment>* Checking gearman settings file...</comment>');
-        }
-
-        $output->writeln('<comment>Gearman is succesfuly installed</comment>');
-    }
-}

+ 5 - 1
Command/GearmanJobDescribeCommand.php

@@ -42,6 +42,10 @@ class GearmanJobDescribeCommand extends ContainerAwareCommand
     {
         $job = $input->getArgument('job');
         $job = $this->getContainer()->get('gearman')->getJob($job);
-        $this->getContainer()->get('gearman.describer')->describeJob($output, $job);
+        
+        $this
+            ->getContainer()
+            ->get('gearman.describer')
+            ->describeJob($output, $job);
     }
 }

+ 1 - 0
Command/GearmanWorkerListCommand.php

@@ -46,6 +46,7 @@ class GearmanWorkerListCommand extends ContainerAwareCommand
             $it = 1;
 
             foreach ($workers as $worker) {
+                
                 $output->writeln('<comment>    @Worker:  </comment><info>'.$worker['className'].'</info>');
                 $output->writeln('<comment>    callablename:  </comment><info>'.$worker['callableName'].'</info>');
                 $output->writeln('<comment>    Jobs:</comment>');

+ 1 - 1
DependencyInjection/Configuration.php

@@ -37,7 +37,7 @@ class Configuration implements ConfigurationInterface
                             ->arrayNode('include')
                                 ->prototype('scalar')->end()
                             ->end()
-                            ->arrayNode('exclude')
+                            ->arrayNode('ignore')
                                 ->prototype('scalar')->end()
                             ->end()
                         ->end()

+ 3 - 14
DependencyInjection/GearmanExtension.php

@@ -29,21 +29,10 @@ class GearmanExtension extends Extension
         $configuration = new Configuration();
         $config = $this->processConfiguration($configuration, $config);
 
-        $container->setParameter(
-            'gearman.bundles',
-            $config['bundles']
-        );
+        $container->setParameter('gearman.bundles', $config['bundles']);
+        $container->setParameter('gearman.servers', $config['servers']);
+        $container->setParameter('gearman.default.settings', $config['defaults']);
 
-        $container->setParameter(
-            'gearman.servers',
-            $config['servers']
-        );
-
-        $container->setParameter(
-            'gearman.params',
-            $config['defaults']
-        );
-        
         $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
         $loader->load('services.yml');
     }

+ 0 - 20
GearmanBundle.php

@@ -11,24 +11,4 @@ use Symfony\Component\HttpKernel\Bundle\Bundle;
  */
 class GearmanBundle extends Bundle
 {
-    /**
-     * Boots the Bundle.
-     * This method load all data and saves all annotations into cache.
-     * Also, it load all settings from Yaml file format
-     *
-     * @api
-     */
-    public function boot()
-    {
-        $gearmanCacheLoader = $this->container->get('gearman.cache.wrapper');
-
-        if ($this->container->get('kernel')->isDebug()) {
-
-            $gearmanCacheLoader->reloadCache($gearmanCache);
-
-        } else {
-
-            $gearmanCacheLoader->loadCache($gearmanCache);
-        }
-    }
 }

+ 10 - 9
Module/JobClass.php

@@ -7,6 +7,7 @@ use Mmoreram\GearmanBundle\Driver\Gearman\Work;
 use Symfony\Component\DependencyInjection\ContainerAware;
 use Mmoreram\GearmanBundle\Exceptions\SettingValueMissingException;
 use Mmoreram\GearmanBundle\Exceptions\SettingValueBadFormatException;
+use ReflectionMethod;
 
 /**
  * Job class
@@ -40,7 +41,7 @@ class JobClass extends ContainerAware
      * RealCallable name for this job
      * natural method name will be used.
      */
-    private $callableName;
+    private $realCallableName;
 
 
     /**
@@ -79,12 +80,12 @@ class JobClass extends ContainerAware
      * Construct method
      *
      * @param Job               $methodAnnotation  MethodAnnotation class
-     * @param \ReflectionMethod $method            ReflextionMethod class
+     * @param ReflectionMethod $method            ReflextionMethod class
      * @param Work              $classAnnotation   Work class
      * @param string            $callableNameClass Callable name class
      * @param array             $settings          Settings structure
      */
-    public function __construct( Job $methodAnnotation, \ReflectionMethod $method, $callableNameClass, array $servers, array $defaultSettings)
+    public function __construct( Job $methodAnnotation, ReflectionMethod $method, $callableNameClass, array $servers, array $defaultSettings)
     {
         $this->callableName = is_null($methodAnnotation->name)
                             ? $method->getName()
@@ -103,9 +104,9 @@ class JobClass extends ContainerAware
                             : $methodAnnotation->iterations;
 
 
-        $this->defaultMethod    = is_null($classAnnotation->defaultMethod)
+        $this->defaultMethod    = is_null($methodAnnotation->defaultMethod)
                                 ? $defaultSettings['method']
-                                : $classAnnotation->defaultMethod;
+                                : $methodAnnotation->defaultMethod;
 
         
         /**
@@ -116,14 +117,14 @@ class JobClass extends ContainerAware
         /**
          * If is configured some servers definition in the worker, overwrites
          */
-        if ($classAnnotation->servers) {
+        if ($methodAnnotation->servers) {
 
-            if (is_array($classAnnotation->servers)) {
+            if (is_array($methodAnnotation->servers)) {
 
-                $this->servers = $classAnnotation->servers;
+                $this->servers = $methodAnnotation->servers;
             } else {
 
-                $this->servers = array($classAnnotation->servers);
+                $this->servers = array($methodAnnotation->servers);
             }
         }
     }

+ 3 - 3
Module/WorkerClass.php

@@ -125,8 +125,8 @@ class WorkerClass
          * Setting worker callable name
          */
         $this->callableName = is_null($classAnnotation->name)
-                            ? $reflectionClass->getName()))
-                            : $this->namespace .'\\' .$classAnnotation->name);
+                            ? $reflectionClass->getName()
+                            : $this->namespace .'\\' .$classAnnotation->name;
 
         $this->callableName = str_replace('\\', '', $this->callableName);
 
@@ -183,7 +183,7 @@ class WorkerClass
 
                 if ($annot instanceof JobAnnotation) {
 
-                    $job = new Job($annot, $reflMethod, $classAnnotation, $this->callableName, $this->servers, $defaultSettings);
+                    $job = new Job($annot, $reflMethod, $this->callableName, $this->servers, $defaultSettings);
                     $this->jobCollection->add($job);
                 }
             }

+ 22 - 13
Resources/config/services.yml

@@ -1,33 +1,42 @@
 parameters:
-    gearman.config.path:        %kernel.root_dir%/config/gearman/%kernel.environment%.yml
 
-    gearman.client.class:       Mmoreram\GearmanBundle\Service\GearmanClient
-    gearman.cache.id:           gearman.workers
-    gearman.cache.wrapper.class: Mmoreram\GearmanBundle\Service\GearmanCacheLoader
-    gearman.execute.class:  Mmoreram\GearmanBundle\Service\GearmanExecute
-    gearman.settings.class:     Mmoreram\GearmanBundle\Service\GearmanSettings
-    gearman.describer.class:     Mmoreram\GearmanBundle\Service\GearmanDescriber
+    gearman.client.class:           Mmoreram\GearmanBundle\Service\GearmanClient
+    gearman.cache.id:               gearman.workers
+    gearman.cache.wrapper.class:    Mmoreram\GearmanBundle\Service\GearmanCacheWrapper
+    gearman.execute.class:          Mmoreram\GearmanBundle\Service\GearmanExecute
+    gearman.describer.class:        Mmoreram\GearmanBundle\Service\GearmanDescriber
 
 
 
 services:
-    gearman:
-        class: %gearman.client.class%
 
     gearman.cache.wrapper:
         class: %gearman.cache.wrapper.class%
         arguments:
-            gearman.bundles: %gearman.bundles%
             kernel: @kernel
-            gearman.cache: @liip_doctrine_cache.ns.mmoreram_gearman
+            gearman.cache: @liip_doctrine_cache.ns.gearman
             gearman.cache.id: %gearman.cache.id%
+            gearman.bundles: %gearman.bundles%
+            gearman.servers: %gearman.servers%
+            gearman.default.settings: %gearman.default.settings%
         calls:
-          - [loadNamespacesMap,  []]
+          - [loadNamespaceMap,  []]
+          - [load,  []]
+
+    gearman.abstract.service:
+        abstract:  true
+        arguments:
+            gearman.cache.wrapper: @gearman.cache.wrapper
 
     gearman.execute:
         class: %gearman.execute.class%
+        parent: gearman.abstract.service
         calls:
-          - [setContainer,  [@service.container]]
+          - [setContainer,  [@service_container]]
+
+    gearman:
+        class: %gearman.client.class%
+        parent: gearman.abstract.service
 
     gearman.describer:
         class: %gearman.describer.class%

+ 13 - 2
Service/Abstracts/AbstractGearmanService.php

@@ -2,7 +2,7 @@
 
 namespace Mmoreram\GearmanBundle\Service\Abstracts;
 
-use Mmoreram\GearmanBundle\Service\GearmanCache as Cache;
+use Mmoreram\GearmanBundle\Service\GearmanCacheWrapper;
 use Mmoreram\GearmanBundle\Exceptions\JobDoesNotExistException;
 use Mmoreram\GearmanBundle\Exceptions\WorkerDoesNotExistException;
 
@@ -29,7 +29,7 @@ abstract class AbstractGearmanService
      */
     public function __construct(GearmanCacheWrapper $gearmanCacheWrapper)
     {
-        $this->workers = $gearmanCacheWrapper->getWorkerCollection();
+        $this->workers = $gearmanCacheWrapper->getWorkers();
     }
 
 
@@ -83,4 +83,15 @@ abstract class AbstractGearmanService
 
         throw new WorkerDoesNotExistException($workerName);
     }
+
+
+    /**
+     * Return array of workers
+     * 
+     * @return array all available workers
+     */
+    public function getWorkers()
+    {
+        return $this->workers;
+    }
 }

+ 76 - 54
Service/GearmanCacheWrapper.php

@@ -87,6 +87,22 @@ class GearmanCacheWrapper
     private $workerCollection;
 
 
+    /**
+     * @var array
+     * 
+     * Collection of servers to connect
+     */
+    private $servers;
+
+
+    /**
+     * @var array
+     * 
+     * Default settings defined by user in config.yml
+     */
+    private $defaultSettings;
+
+
     /**
      * Return workerCollection
      * 
@@ -94,7 +110,7 @@ class GearmanCacheWrapper
      */
     public function getWorkers()
     {
-        return $workerCollection;
+        return $this->workerCollection;
     }
 
 
@@ -103,12 +119,14 @@ class GearmanCacheWrapper
      *
      * @param array $bundles Bundles
      */
-    public function __construct(array $bundles, Kernel $kernel, Cache $cache, $cacheId)
+    public function __construct(Kernel $kernel, Cache $cache, $cacheId, array $bundles, array $servers, array $defaultSettings)
     {
         $this->kernelBundles = $kernel->getBundles();
         $this->bundles = $bundles;
         $this->cache = $cache;
         $this->cacheId = $cacheId;
+        $this->servers = $servers;
+        $this->defaultSettings = $defaultSettings;
     }
 
 
@@ -117,12 +135,16 @@ class GearmanCacheWrapper
      *
      * @return GearmanCacheLoader self Object
      */
-    public function loadCache()
+    public function load()
     {
-        if (!$this->cache->contains($this->cacheId)) {
+        if ($this->cache->contains($this->cacheId)) {
+
+            $this->workerCollection = $this->cache->get($this->cacheId);
+
+        } else {
 
             $this->workerCollection = $this->parseNamespaceMap()->toArray();
-            $this->cache->save($this->cacheId, $workerCollection);
+            $this->cache->save($this->cacheId, $this->workerCollection);
         }
 
         return $this;
@@ -130,15 +152,56 @@ class GearmanCacheWrapper
 
 
     /**
-     * Reloads Gearman cache
-     *
+     * flush all cache
+     * 
      * @return GearmanCacheLoader self Object
      */
-    public function reloadCache()
+    public function flush()
     {
         $this->cache->delete($this->cacheId);
 
-        return $this->loadCache();
+        return $this;
+    }
+
+
+    /**
+     * Return Gearman bundle settings, previously loaded by method load()
+     * If settings are not loaded, a SettingsNotLoadedException Exception is thrown
+     *
+     * @return array Bundles that gearman will be able to search annotations
+     */
+    public function loadNamespaceMap()
+    {
+        foreach ($this->bundles as $bundleSettings) {
+
+            $bundleNamespace = $bundleSettings['namespace'];
+
+            if ($bundleSettings['active']) {
+
+                $this->bundlesAccepted[] = $bundleNamespace;
+
+                if (!empty($bundleSettings['include'])) {
+
+                    foreach ($bundleSettings['include'] as $include) {
+
+                        $this->namespacesAccepted[] = $bundleNamespace . '\\' . $include;
+                    }
+
+                } else {
+
+                    /**
+                     * If no include is set, include all namespace
+                     */
+                    $this->namespacesAccepted[] = $bundleNamespace;
+
+                }
+
+                foreach ($bundleSettings['ignore'] as $ignore) {
+
+                    $this->namespacesIgnored[] = $bundleNamespace . '\\' . $ignore;
+                }
+            }
+        }
     }
 
 
@@ -175,7 +238,7 @@ class GearmanCacheWrapper
             }
 
             $filesLoader = new WorkerDirectoryLoader(new FileLocator('.'));
-            $files = $filesLoader->load($bundle->getPath());
+            $files = $filesLoader->load($kernelBundle->getPath());
 
             foreach ($files as $file) {
 
@@ -201,7 +264,8 @@ class GearmanCacheWrapper
 
                             if ($annot instanceof Work) {
 
-                                $workerCollection->add(new Worker($annot, $reflClass, $reader, $this->getSettings()));
+                                $worker = new Worker($annot, $reflClass, $reader, $this->servers, $this->defaultSettings);
+                                $workerCollection->add($worker);
                             }
                         }
 
@@ -215,48 +279,6 @@ class GearmanCacheWrapper
     }
 
 
-    /**
-     * Return Gearman bundle settings, previously loaded by method load()
-     * If settings are not loaded, a SettingsNotLoadedException Exception is thrown
-     *
-     * @return array Bundles that gearman will be able to search annotations
-     */
-    private function loadNamespacesMap()
-    {
-
-        foreach ($this->bundles as $bundleSettings) {
-
-            $bundleNamespace = $properties['namespace'];
-
-            if ($bundleSettings['active'])) {
-
-                $this->bundlesAccepted[] = $bundleNamespace;
-
-                if (!empty($properties['include'])) {
-
-                    foreach ($properties['include'] as $include) {
-
-                        $this->namespaceAccepted[] = $bundleNamespace . '\\' . $include;
-                    }
-
-                } else {
-
-                    /**
-                     * If no include is set, include all namespace
-                     */
-                    $this->namespaceAccepted[] = $bundleNamespace;
-
-                }
-
-                foreach ($properties['ignore'] as $ignore) {
-
-                    $this->namespacesIgnored[] = $bundleNamespace . '\\' . $ignore;
-                }
-            }
-        }
-    }
-
-
     /**
      * Checks if namespace is subnamespace of another
      *
@@ -267,6 +289,6 @@ class GearmanCacheWrapper
      */
     private function isSubNamespace($namespace, $subNamespace)
     {
-        return ( strstr($class, $ns) !== false );
+        return ( strpos($subNamespace, $namespace) === 0 );
     }
 }

+ 3 - 4
Service/GearmanClient.php

@@ -5,7 +5,6 @@ namespace Mmoreram\GearmanBundle\Service;
 use Mmoreram\GearmanBundle\Service\Abstracts\AbstractGearmanService;
 use Mmoreram\GearmanBundle\Service\GearmanInterface;
 use Mmoreram\GearmanBundle\Exceptions\NoCallableGearmanMethodException;
-use GearmanClient;
 
 /**
  * Implementation of GearmanInterface
@@ -93,7 +92,7 @@ class GearmanClient extends AbstractGearmanService
      */
     private function doEnqueue(Array $worker, $params = '', $method = 'do', $unique = null)
     {
-        $gmclient = new GearmanClient();
+        $gmclient = new \GearmanClient();
         $this->assignServers($gmclient);
 
         return $gmclient->$method($worker['job']['realCallableName'], serialize($params), $unique);
@@ -123,7 +122,7 @@ class GearmanClient extends AbstractGearmanService
      *
      * @return GearmanClient Returns self object
      */
-    private function assignServers(GearmanClient $gearmanClient)
+    private function assignServers(\GearmanClient $gearmanClient)
     {
         if (empty($this->server)) {
 
@@ -448,7 +447,7 @@ class GearmanClient extends AbstractGearmanService
     public function runTasks()
     {
         $taskStructure = $this->taskStructure;
-        $gearmanClient = new GearmanClient();
+        $gearmanClient = new \GearmanClient();
         $this->assignServers($gearmanClient);
 
         foreach ($this->taskStructure as $task) {

+ 18 - 18
Service/GearmanDescriber.php

@@ -48,20 +48,20 @@ class GearmanDescriber
 
         $this->describeWorker($output, $worker);
         $job = $worker['job'];
-        $output->writeln('<info>    @job\methodName : '.$job['methodName'].'</info>');
-        $output->writeln('<info>    @job\callableName : '.$job['realCallableName'].'</info>');
-        $output->writeln('<info>    @job\supervisord : </info><comment>/usr/bin/php '.$script.' '.$job['realCallableName'].' --no-interaction</comment>');
-        $output->writeln('<info>    @job\iterations : '.$job['iterations'].'</info>');
-        $output->writeln('<info>    @job\defaultMethod : '.$job['defaultMethod'].'</info>');
+        $output->writeln('<info>    @job\methodName : ' . $job['methodName'] . '</info>');
+        $output->writeln('<info>    @job\callableName : ' . $job['realCallableName'] . '</info>');
+        $output->writeln('<info>    @job\supervisord : </info><comment>/usr/bin/php ' . $script.' ' . $job['realCallableName'] . ' --no-interaction</comment>');
+        $output->writeln('<info>    @job\iterations : ' . $job['iterations'] . '</info>');
+        $output->writeln('<info>    @job\defaultMethod : ' . $job['defaultMethod'] . '</info>');
         $output->writeln('<info>    @job\servers :</info>');
         $output->writeln('');
         foreach ($job['servers'] as $name => $server) {
-            $output->writeln('<comment>        '.$name.' - '.$server.'</comment>');
+            $output->writeln('<comment>        ' . $name . ' - ' . $server['host'] . ':' . $server['port'] . '</comment>');
         }
         $output->writeln('');
         $output->writeln('<info>    @job\description :</info>');
         $output->writeln('');
-        $output->writeln('<comment>        # '.$job['description'].'</comment>');
+        $output->writeln('<comment>        #' . $job['description'] . '</comment>');
         $output->writeln('');
     }
 
@@ -76,19 +76,19 @@ class GearmanDescriber
      */
     public function describeWorker(OutputInterface $output, array $worker, $tinyJobDescription = false)
     {
-        $script = $this->container->get('kernel')->getRootDir() . '/console gearman:worker:execute';
+        $script = $this->kernel->getRootDir() . '/console gearman:worker:execute';
 
         $output->writeln('');
-        $output->writeln('<info>    @Worker\className : '.$worker['className'].'</info>');
-        $output->writeln('<info>    @Worker\fileName : '.$worker['fileName'].'</info>');
-        $output->writeln('<info>    @Worker\nameSpace : '.$worker['namespace'].'</info>');
-        $output->writeln('<info>    @Worker\callableName: '.$worker['callableName'].'</info>');
-        $output->writeln('<info>    @Worker\supervisord : </info><comment>/usr/bin/php '.$script.' '.$worker['callableName'].' --no-interaction</comment>');
+        $output->writeln('<info>    @Worker\className : ' . $worker['className'] . '</info>');
+        $output->writeln('<info>    @Worker\fileName : ' . $worker['fileName'] . '</info>');
+        $output->writeln('<info>    @Worker\nameSpace : ' . $worker['namespace'] . '</info>');
+        $output->writeln('<info>    @Worker\callableName: ' . $worker['callableName'] . '</info>');
+        $output->writeln('<info>    @Worker\supervisord : </info><comment>/usr/bin/php ' . $script.' ' . $worker['callableName'] . ' --no-interaction</comment>');
 
         if (null !== $worker['service']) {
-            $output->writeln('<info>    @Worker\service : '.$worker['service'].'</info>');
+            $output->writeln('<info>    @Worker\service : ' . $worker['service'] . '</info>');
         }
-        $output->writeln('<info>    @worker\iterations : '.$worker['iterations'].'</info>');
+        $output->writeln('<info>    @worker\iterations : ' . $worker['iterations'] . '</info>');
         $output->writeln('<info>    @Worker\#jobs : '.count($worker['jobs']).'</info>');
 
 
@@ -96,7 +96,7 @@ class GearmanDescriber
             $output->writeln('<info>    @Worker\jobs</info>');
             $output->writeln('');
             foreach ($worker['jobs'] as $job) {
-                $output->writeln('<comment>        # '.$job['realCallableName'].'</comment>');
+                $output->writeln('<comment>        # ' . $job['realCallableName'] . '</comment>');
             }
         }
 
@@ -104,12 +104,12 @@ class GearmanDescriber
         $output->writeln('<info>    @worker\servers :</info>');
         $output->writeln('');
         foreach ($worker['servers'] as $name => $server) {
-            $output->writeln('<comment>        # '.$name.' - '.$server.'</comment>');
+            $output->writeln('<comment>        #' . $name . ' - ' . $server['host'] . ':' . $server['port'] . '</comment>');
         }
         $output->writeln('');
         $output->writeln('<info>    @Worker\description :</info>');
         $output->writeln('');
-        $output->writeln('<comment>        '.$worker['description'].'</comment>');
+        $output->writeln('<comment>        ' . $worker['description'] . '</comment>');
         $output->writeln('');
     }
 }

+ 1 - 1
Service/GearmanExecute.php

@@ -20,7 +20,7 @@ class GearmanExecute extends AbstractGearmanService
      *
      * Container instance
      */
-    private $container = $container;
+    private $container;
 
 
     /**