|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cli\CliBundle\Command; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Console\Exception\InvalidArgumentException; |
|
6
|
|
|
use Todo\Application\Task\Command; |
|
7
|
|
|
use Todo\Application\Task\Exception\TaskCannotBeRemovedException; |
|
8
|
|
|
use Todo\Domain\Task; |
|
9
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
|
10
|
|
|
use Symfony\Component\Console\Exception\LogicException; |
|
11
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
|
12
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class TaskCleanCommand |
|
16
|
|
|
* |
|
17
|
|
|
* @category None |
|
18
|
|
|
* @package Cli\CliBundle\Command |
|
19
|
|
|
* @author Martin Pham <[email protected]> |
|
20
|
|
|
* @license None http:// |
|
21
|
|
|
* @link None |
|
22
|
|
|
*/ |
|
23
|
|
|
class TaskCleanCommand extends ContainerAwareCommand |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* TaskCommand |
|
27
|
|
|
* |
|
28
|
|
|
* @var Command |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $taskCommand; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* TaskListCommand constructor |
|
34
|
|
|
* |
|
35
|
|
|
* @param Command $taskCommand Task Command |
|
36
|
|
|
* |
|
37
|
|
|
* @throws LogicException |
|
38
|
|
|
*/ |
|
39
|
|
|
public function __construct(Command $taskCommand) |
|
40
|
|
|
{ |
|
41
|
|
|
$this->taskCommand = $taskCommand; |
|
42
|
|
|
|
|
43
|
|
|
try { |
|
44
|
|
|
parent::__construct(); |
|
45
|
|
|
} catch (LogicException $e) { |
|
|
|
|
|
|
46
|
|
|
throw $e; |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Configure |
|
53
|
|
|
* |
|
54
|
|
|
* @return void |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function configure() |
|
57
|
|
|
{ |
|
58
|
|
|
try { |
|
59
|
|
|
$this |
|
60
|
|
|
->setName('task:clean') |
|
61
|
|
|
->setDescription('...'); |
|
62
|
|
|
} catch (InvalidArgumentException $e) { |
|
|
|
|
|
|
63
|
|
|
// no catch exception |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Execute |
|
69
|
|
|
* |
|
70
|
|
|
* @param InputInterface $input Input |
|
71
|
|
|
* @param OutputInterface $output Output |
|
72
|
|
|
* |
|
73
|
|
|
* @return void |
|
74
|
|
|
* @throws LogicException |
|
75
|
|
|
* @throws TaskCannotBeRemovedException |
|
76
|
|
|
*/ |
|
77
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
|
78
|
|
|
{ |
|
79
|
|
|
try { |
|
80
|
|
|
parent::execute($input, $output); |
|
81
|
|
|
} catch (LogicException $e) { |
|
|
|
|
|
|
82
|
|
|
// no catch |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
try { |
|
86
|
|
|
$this->taskCommand->cleanAllCompletedTasks(); |
|
87
|
|
|
} catch (TaskCannotBeRemovedException $e) { |
|
88
|
|
|
throw $e; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
|
|
92
|
|
|
$output->writeln('Cleaned'); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
} |
|
96
|
|
|
|
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.