1 | <?php |
||
2 | /* (c) Anton Medvedev <[email protected]> |
||
3 | * |
||
4 | * For the full copyright and license information, please view the LICENSE |
||
5 | * file that was distributed with this source code. |
||
6 | */ |
||
7 | |||
8 | namespace Deployer\Console; |
||
9 | |||
10 | use Symfony\Component\Console\Command\Command; |
||
11 | use Symfony\Component\Console\Input\InputArgument; |
||
12 | use Symfony\Component\Console\Input\InputInterface as Input; |
||
13 | use Symfony\Component\Console\Output\OutputInterface as Output; |
||
14 | |||
15 | class DiceCommand extends Command |
||
16 | { |
||
17 | private $deployer; |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
18 | |||
19 | 12 | public function __construct() |
|
20 | { |
||
21 | 12 | parent::__construct('roll:dice'); |
|
22 | 12 | $this->setDescription('Roll any number of dice'); |
|
23 | 12 | } |
|
24 | |||
25 | 12 | protected function configure() |
|
26 | { |
||
27 | 12 | $this->addArgument('number', InputArgument::OPTIONAL, 'Number of dice', 2); |
|
28 | 12 | } |
|
29 | |||
30 | protected function execute(Input $input, Output $output) |
||
31 | { |
||
32 | $number = intval($input->getArgument('number')); |
||
33 | while ($number-- > 0) { |
||
34 | $output->write(["⚀", "⚁", "⚂", "⚃", "⚄", "⚅"][rand(0, 5)]); |
||
35 | } |
||
36 | $output->write("\n"); |
||
37 | return 0; |
||
38 | } |
||
39 | } |
||
40 |