1<?php
2
3namespace Kanboard\Console;
4
5use Kanboard\Core\Queue\JobHandler;
6use SimpleQueue\Job;
7use Symfony\Component\Console\Input\InputInterface;
8use Symfony\Component\Console\Output\OutputInterface;
9
10/**
11 * Class JobCommand
12 *
13 * @package Kanboard\Console
14 * @author  Frederic Guillot
15 */
16class JobCommand extends BaseCommand
17{
18    protected function configure()
19    {
20        $this
21            ->setName('job')
22            ->setDescription('Execute individual job (read payload from stdin)')
23        ;
24    }
25
26    protected function execute(InputInterface $input, OutputInterface $output)
27    {
28        $payload = fgets(STDIN);
29
30        $job = new Job();
31        $job->unserialize($payload);
32
33        JobHandler::getInstance($this->container)->executeJob($job);
34    }
35}
36