ProcessNextScheduleCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 28
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 5 1
A configure() 0 4 1
A __construct() 0 5 1
1
<?php
2
3
namespace Tkotosz\CommandScheduler\Console\Command;
4
5
use Tkotosz\CommandScheduler\Model\CommandScheduleProcessor;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class ProcessNextScheduleCommand extends Command
12
{
13
    /**
14
     * @var CommandScheduleProcessor
15
     */
16
    private $commandScheduleProcessor;
17
    
18
    /**
19
     * @param CommandScheduleProcessor $commandScheduleProcessor
20
     */
21
    public function __construct(CommandScheduleProcessor $commandScheduleProcessor)
22
    {
23
        parent::__construct();
24
25
        $this->commandScheduleProcessor = $commandScheduleProcessor;
26
    }
27
    
28
    protected function configure()
29
    {
30
        $this->setName('command-scheduler:process-next-schedule')
31
            ->setDescription('Processes the next pending schedule');
32
    }
33
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $result = $this->commandScheduleProcessor->processNext();
37
38
        $output->writeln($result);
39
    }
40
}
41