ListApplicationCommand::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the SexyField package.
5
 *
6
 * (c) Dion Snoeijen <[email protected]>
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
declare (strict_types = 1);
13
14
namespace Tardigrades\Command;
15
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
use Tardigrades\SectionField\Service\ApplicationManagerInterface;
19
use Tardigrades\SectionField\Service\ApplicationNotFoundException;
20
21
class ListApplicationCommand extends ApplicationCommand
22
{
23
    private $applicationManager;
24
25
    public function __construct(
26
        ApplicationManagerInterface $applicationManager
27
    ) {
28
        $this->applicationManager = $applicationManager;
29
30
        parent::__construct('sf:list-application');
31
    }
32
33
    protected function configure()
34
    {
35
        $this
36
            ->setDescription('Show applications')
37
            ->setHelp('Show applications');
38
    }
39
40
    protected function execute(InputInterface $input, OutputInterface $output)
41
    {
42
        try {
43
            $applications = $this->applicationManager->readAll();
44
            $this->renderTable($output, $applications, 'All installed Applications');
45
        } catch (ApplicationNotFoundException $exception) {
46
            $output->writeln('No applications found');
47
        }
48
    }
49
}
50