1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the core-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\CoreBundle\Command; |
13
|
|
|
|
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Console\Application; |
15
|
|
|
use Symfony\Component\Console\Command\Command; |
16
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
17
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
18
|
|
|
use Symfony\Component\Console\Style\StyleInterface; |
19
|
|
|
use WBW\Bundle\CoreBundle\Helper\CommandHelper; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Abstract command. |
23
|
|
|
* |
24
|
|
|
* @author webeweb <https://github.com/webeweb/> |
25
|
|
|
* @package WBW\Bundle\CoreBundle\Command |
26
|
|
|
* @abstract |
27
|
|
|
*/ |
28
|
|
|
abstract class AbstractCommand extends Command { |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Displays the header. |
32
|
|
|
* |
33
|
|
|
* @param StyleInterface $io The I/O. |
34
|
|
|
* @return void |
35
|
|
|
*/ |
36
|
|
|
protected function displayHeader(StyleInterface $io, $text) { |
37
|
|
|
$io->newLine(); |
38
|
|
|
$io->text($text); |
39
|
|
|
$io->newLine(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Get the application. |
44
|
|
|
* |
45
|
|
|
* @return Application|null Returns the application. |
46
|
|
|
*/ |
47
|
|
|
public function getApplication() { |
48
|
|
|
return parent::getApplication(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get a checkbox. |
53
|
|
|
* |
54
|
|
|
* @param bool $checked Checked ? |
55
|
|
|
* @return string Returns the checkbox. |
56
|
|
|
*/ |
57
|
|
|
protected function getCheckbox($checked) { |
58
|
|
|
return CommandHelper::getCheckbox($checked); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Create a style. |
63
|
|
|
* |
64
|
|
|
* @param InputInterface $input The input. |
65
|
|
|
* @param OutputInterface $output The output. |
66
|
|
|
* @return StyleInterface Returns the style. |
67
|
|
|
*/ |
68
|
|
|
protected function newStyle(InputInterface $input, OutputInterface $output) { |
69
|
|
|
return CommandHelper::newSymfonyStyle($input, $output); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|