123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- /**
- * Gearman Bundle for Symfony2
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- *
- * Feel free to edit as you please, and have fun.
- *
- * @author Marc Morera <yuhu@mmoreram.com>
- */
- namespace Mmoreram\GearmanBundle\Command;
- use Symfony\Component\Console\Input\InputArgument;
- use Symfony\Component\Console\Input\InputInterface;
- use Symfony\Component\Console\Output\OutputInterface;
- use Mmoreram\GearmanBundle\Command\Abstracts\AbstractGearmanCommand;
- use Mmoreram\GearmanBundle\Service\GearmanClient;
- use Mmoreram\GearmanBundle\Service\GearmanDescriber;
- /**
- * Gearman Job Describe Command class
- *
- * @since 2.3.1
- */
- class GearmanJobDescribeCommand extends AbstractGearmanCommand
- {
- /**
- * @var GearmanClient
- *
- * Gearman client
- */
- protected $gearmanClient;
- /**
- * @var GearmanDescriber
- *
- * GearmanDescriber
- */
- protected $gearmanDescriber;
- /**
- * Set gearman client
- *
- * @param GearmanClient $gearmanClient Gearman client
- *
- * @return GearmanJobDescribeCommand self Object
- */
- public function setGearmanClient(GearmanClient $gearmanClient)
- {
- $this->gearmanClient = $gearmanClient;
- return $this;
- }
- /**
- * set Gearman describer
- *
- * @param GearmanDescriber $gearmanDescriber GearmanDescriber
- *
- * @return GearmanJobDescribeCommand self Object
- */
- public function setGearmanDescriber(GearmanDescriber $gearmanDescriber)
- {
- $this->gearmanDescriber = $gearmanDescriber;
- return $this;
- }
- /**
- * Console Command configuration
- */
- protected function configure()
- {
- $this
- ->setName('gearman:job:describe')
- ->setDescription('Describe given job')
- ->addArgument(
- 'job',
- InputArgument::REQUIRED,
- 'job to describe'
- );
- }
- /**
- * 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)
- {
- $job = $input->getArgument('job');
- $job = $this->gearmanClient->getJob($job);
- $this
- ->gearmanDescriber
- ->describeJob($output, $job);
- }
- }
|