|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cli\CliBundle\Command; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Console\Exception\InvalidArgumentException; |
|
6
|
|
|
use Todo\Application\Task\Query; |
|
7
|
|
|
use Todo\Domain\Task; |
|
8
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
|
9
|
|
|
use Symfony\Component\Console\Exception\LogicException; |
|
10
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
11
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Class TaskListCommand |
|
15
|
|
|
* |
|
16
|
|
|
* @category None |
|
17
|
|
|
* @package Cli\CliBundle\Command |
|
18
|
|
|
* @author Martin Pham <[email protected]> |
|
19
|
|
|
* @license None http:// |
|
20
|
|
|
* @link None |
|
21
|
|
|
*/ |
|
22
|
|
|
class TaskListCommand extends ContainerAwareCommand |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* TaskQuery |
|
26
|
|
|
* |
|
27
|
|
|
* @var Query |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $taskQuery; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* TaskListCommand constructor |
|
33
|
|
|
* |
|
34
|
|
|
* @param Query $taskQuery Task Query |
|
35
|
|
|
* |
|
36
|
|
|
* @throws LogicException |
|
37
|
|
|
*/ |
|
38
|
|
|
public function __construct(Query $taskQuery) |
|
39
|
|
|
{ |
|
40
|
|
|
$this->taskQuery = $taskQuery; |
|
41
|
|
|
|
|
42
|
|
|
try { |
|
43
|
|
|
parent::__construct(); |
|
44
|
|
|
} catch (LogicException $e) { |
|
|
|
|
|
|
45
|
|
|
throw $e; |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Configure |
|
51
|
|
|
* |
|
52
|
|
|
* @return void |
|
53
|
|
|
*/ |
|
54
|
|
|
protected function configure() |
|
55
|
|
|
{ |
|
56
|
|
|
try { |
|
57
|
|
|
$this |
|
58
|
|
|
->setName('task:list') |
|
59
|
|
|
->setDescription('...'); |
|
60
|
|
|
} catch (InvalidArgumentException $e) { |
|
|
|
|
|
|
61
|
|
|
// no catch exception |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Execute |
|
67
|
|
|
* |
|
68
|
|
|
* @param InputInterface $input Input |
|
69
|
|
|
* @param OutputInterface $output Output |
|
70
|
|
|
* |
|
71
|
|
|
* @return void |
|
72
|
|
|
* @throws LogicException |
|
73
|
|
|
*/ |
|
74
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
75
|
|
|
{ |
|
76
|
|
|
try { |
|
77
|
|
|
parent::execute($input, $output); |
|
78
|
|
|
} catch (LogicException $e) { |
|
|
|
|
|
|
79
|
|
|
// no catch |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
$output->writeln('Remaining'); |
|
83
|
|
|
|
|
84
|
|
|
$remainingTasks = $this->taskQuery->getAllRemainingTasks(); |
|
85
|
|
|
|
|
86
|
|
|
/** @var Task $task */ |
|
87
|
|
|
foreach ($remainingTasks as $task) { |
|
88
|
|
|
$output->writeln($task->getId() . ' - ' . $task->getName() . ''); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
$output->writeln(''); |
|
92
|
|
|
|
|
93
|
|
|
$output->writeln('Completed'); |
|
94
|
|
|
|
|
95
|
|
|
$completedTasks = $this->taskQuery->getAllCompletedTasks(); |
|
96
|
|
|
|
|
97
|
|
|
foreach ($completedTasks as $task) { |
|
98
|
|
|
$output->writeln($task->getId() . ' - ' . $task->getName()); |
|
99
|
|
|
} |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
} |
|
103
|
|
|
|
Scrutinizer analyzes your
composer.json/composer.lockfile if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.