VersionCommand::execute()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 3
nc 1
nop 2
1
<?php
2
/**
3
 * Mage Scan
4
 *
5
 * PHP version 5
6
 *
7
 * @category  MageScan
8
 * @package   MageScan
9
 * @author    Steve Robbins <[email protected]>
10
 * @copyright 2015 Steve Robbins
11
 * @license   http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
12
 * @link      https://github.com/steverobbins/magescan
13
 */
14
15
namespace MageScan\Command\Scan;
16
17
use MageScan\Check\Version;
18
use Symfony\Component\Console\Input\InputInterface;
19
use Symfony\Component\Console\Output\OutputInterface;
20
21
/**
22
 * Scan version command
23
 *
24
 * @category  MageScan
25
 * @package   MageScan
26
 * @author    Steve Robbins <[email protected]>
27
 * @copyright 2015 Steve Robbins
28
 * @license   http://creativecommons.org/licenses/by/4.0/ CC BY 4.0
29
 * @link      https://github.com/steverobbins/magescan
30
 */
31
class VersionCommand extends AbstractCommand
32
{
33
    /**
34
     * Configure command
35
     *
36
     * @return void
37
     */
38
    protected function configure()
39
    {
40
        $this
41
            ->setName('scan:version')
42
            ->setDescription('Get the version of a Magento installation');
43
        parent::configure();
44
    }
45
46
    /**
47
     * Execute command
48
     *
49
     * @param InputInterface  $input
50
     * @param OutputInterface $output
51
     *
52
     * @return void
53
     */
54
    protected function execute(InputInterface $input, OutputInterface $output)
55
    {
56
        $version = new Version;
57
        $version->setRequest($this->request);
58
        $version = $version->getInfo();
59
        $this->out('Magento Information', [[
60
            'type' => 'table',
61
            'data' => [
62
                ['Parameter', 'Value'],
63
                [
64
                    ['Edition', $version[0] ?: 'Unknown'],
65
                    ['Version', $version[1] ?: 'Unknown'],
66
                ]
67
            ]
68
        ]]);
69
    }
70
}
71