Completed
Push — master ( 0c2470...f8b029 )
by WEBEWEB
01:34
created

AbstractCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 44
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A displayHeader() 0 5 1
A getApplication() 0 3 1
A getCheckbox() 0 3 1
A newStyle() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
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
namespace WBW\Bundle\CoreBundle\Command;
13
14
use Symfony\Bundle\FrameworkBundle\Console\Application;
15
use Symfony\Component\Console\Command\Command;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
use Symfony\Component\Console\Style\StyleInterface;
19
use WBW\Bundle\CoreBundle\Helper\CommandHelper;
20
21
/**
22
 * Abstract command.
23
 *
24
 * @author webeweb <https://github.com/webeweb/>
25
 * @package WBW\Bundle\CoreBundle\Command
26
 * @abstract
27
 */
28
abstract class AbstractCommand extends Command {
29
30
    /**
31
     * Displays the header.
32
     *
33
     * @param StyleInterface $io The I/O.
34
     * @return void
35
     */
36
    protected function displayHeader(StyleInterface $io, $text) {
37
        $io->newLine();
38
        $io->text($text);
39
        $io->newLine();
40
    }
41
42
    /**
43
     * Get the application.
44
     *
45
     * @return Application|null Returns the application.
46
     */
47
    public function getApplication() {
48
        return parent::getApplication();
49
    }
50
51
    /**
52
     * Get a checkbox.
53
     *
54
     * @param bool $checked Checked ?
55
     * @return string Returns the checkbox.
56
     */
57
    protected function getCheckbox($checked) {
58
        return CommandHelper::getCheckbox($checked);
59
    }
60
61
    /**
62
     * Create a style.
63
     *
64
     * @param InputInterface $input The input.
65
     * @param OutputInterface $output The output.
66
     * @return StyleInterface Returns the style.
67
     */
68
    protected function newStyle(InputInterface $input, OutputInterface $output) {
69
        return CommandHelper::newSymfonyStyle($input, $output);
70
    }
71
}
72