Completed
Push — master ( b43ac6...c553e5 )
by grégoire
01:54
created

InspectType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 9 1
A execute() 0 17 2
1
<?php
2
/*
3
 * This file is part of Pomm's Cli package.
4
 *
5
 * (c) 2014 - 2017 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\Cli\Command;
11
12
use Symfony\Component\Console\Command\Command;
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
/**
17
 * InspectType
18
 *
19
 * Display the list of converted types.
20
 *
21
 * @package   Cli
22
 * @copyright 2014 - 2015 Grégoire HUBERT
23
 * @author    Grégoire HUBERT
24
 * @license   X11 {@link http://opensource.org/licenses/mit-license.php}
25
 * @see       SessionAwareCommand
26
 */
27
class InspectType extends SessionAwareCommand
28
{
29
    /**
30
     * configure
31
     *
32
     * @see command
33
     */
34
    protected function configure()
35
    {
36
        $this
37
            ->setName("pomm:inspect:type")
38
            ->setDescription("Show converted types list.")
39
            ;
40
41
        parent::configure();
42
    }
43
44
    /**
45
     * execute
46
     *
47
     * Set pomm dependent variables.
48
     *
49
     * @see Command
50
     */
51
    protected function execute(InputInterface $input, OutputInterface $output)
52
    {
53
        parent::execute($input, $output);
54
        $types = $this
55
            ->getSession()
56
            ->getPoolerForType('converter')
57
            ->getConverterHolder()
58
            ->getTypes();
59
        $types = array_filter($types, function ($type) {
60
            return !preg_match('/^pg_catalog\./', $type);
61
        });
62
        natcasesort($types);
63
64
        foreach ($types as $type) {
65
                $output->writeln($type);
66
        }
67
    }
68
}
69