Passed
Push — master ( 6e26c0...38e037 )
by Dan
02:58
created

ListPlacersCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 13 2
1
<?php
2
3
namespace SixtyNine\Cloud\Command;
4
5
use SixtyNine\Cloud\Factory\PlacerFactory;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class ListPlacersCommand extends Command
13
{
14
    protected function configure()
15
    {
16
        $this
17
            ->setName('list:placers')
18
            ->setDescription('List all word placers')
19
        ;
20
    }
21
22
    protected function execute(InputInterface $input, OutputInterface $output)
23
    {
24
        $placers = PlacerFactory::getInstance()->getPlacersNames();
25
        $output->write('Available words placers: ');
26
27
        if (!count($placers)) {
28
            $output->writeln('none');
29
            return;
30
        }
31
32
33
        $output->writeln(join(', ', $placers));
34
    }
35
}
36