Completed
Push — master ( c29911...216b60 )
by WEBEWEB
02:23
created

CommandHelper::newSymfonyStyle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\Helper;
13
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
use Symfony\Component\Console\Style\StyleInterface;
17
use Symfony\Component\Console\Style\SymfonyStyle;
18
19
/**
20
 * Command helper.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Bundle\CoreBundle\Helper
24
 */
25
class CommandHelper {
26
27
    /**
28
     * Get a checkbox.
29
     *
30
     * @param bool $checked Checked ?
31
     * @return string Returns the checkbox.
32
     */
33
    public static function getCheckbox($checked) {
34
        if (true === $checked) {
35
            return sprintf("<fg=green;options=bold>%s</>", OSHelper::isWindows() ? "OK" : "\xE2\x9C\x94");
36
        }
37
        return sprintf("<fg=yellow;options=bold>%s</>", OSHelper::isWindows() ? "KO" : "!");
38
    }
39
40
    /**
41
     * Create a Symfony style.
42
     *
43
     * @param InputInterface $input The input.
44
     * @param OutputInterface $output The output.
45
     * @return StyleInterface Returns the Symfony style.
46
     */
47
    public static function newSymfonyStyle(InputInterface $input, OutputInterface $output) {
48
        return new SymfonyStyle($input, $output);
49
    }
50
}
51