ListDueCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 5
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 16 2
1
<?php
2
namespace Mistletoe\Application\Commands;
3
4
use Symfony\Component\Console\Input\InputArgument;
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * Class RunDueCommand
10
 * @package Mistletoe\Application\Commands
11
 */
12
class ListDueCommand extends AbstractCommand
13
{
14
    protected function configure()
15
    {
16
        $this
17
            ->setName('list:due')
18
            ->setDescription('List all due tasks')
19
            ->addArgument('path', InputArgument::OPTIONAL, "Where is your Mistletoe Project File?");;
0 ignored issues
show
Coding Style introduced by
It is generally recommended to place each PHP statement on a line by itself.

Let’s take a look at an example:

// Bad
$a = 5; $b = 6; $c = 7;

// Good
$a = 5;
$b = 6;
$c = 7;
Loading history...
20
    }
21
22
    protected function execute(InputInterface $input, OutputInterface $output)
23
    {
24
        $planner = $this->getTaskPlanner($input->getArgument('path'));
25
        $dueTasks = $planner->getDueTasks();
26
27
        $planner->flagForTesting();
28
        $commands = $planner->runDueTasks();
29
30
        $this->listTasks($output, $dueTasks);
31
        $output->writeln("\nAnd the commands run are: ");
32
33
        /** @var array $commands */
34
        foreach ($commands as $command) {
35
            $output->writeln($command);
36
        }
37
    }
38
}
39