Completed
Push — master ( ed5962...9634df )
by Nikola
03:22
created

RunOpenCodeStyle::ul()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 3
crap 12
1
<?php
2
/*
3
 * This file is part of the Abstract builder package, an RunOpenCode project.
4
 *
5
 * (c) 2017 RunOpenCode
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 RunOpenCode\AbstractBuilder\Command\Style;
11
12
use Symfony\Component\Console\Style\SymfonyStyle;
13
14
/**
15
 * Class RunOpenCodeStyle
16
 *
17
 * @package RunOpenCode\AbstractBuilder\Command\Style
18
 */
19
class RunOpenCodeStyle extends SymfonyStyle
20
{
21
    /**
22
     * Display information message
23
     *
24
     * @param string $message
25
     */
26
    public function info($message)
27
    {
28
        $this->writeln(sprintf('[<fg=green>OK</>] %s', (string) $message));
29
    }
30
31
    /**
32
     * Display unordered list items
33
     *
34
     * @param array $items
35
     */
36
    public function ul(array $items, $indentation = 0, $symbol = '•')
37
    {
38
        $spaces = str_repeat(' ', $indentation);
39
40
        foreach ($items as $item) {
41
42
            if (is_array($item)) {
43
                $this->ul($item, ++$indentation, $symbol);
44
                continue;
45
            }
46
47
            $this->writeln(sprintf('%s  [<fg=green>%s</>] %s', $spaces,$symbol, (string) $item));
48
        }
49
    }
50
51
    /**
52
     * Display logo.
53
     *
54
     * @return void
55
     */
56
    public function displayLogo()
57
    {
58
        $resource = fopen(__DIR__ . '/../../../../../LOGO', 'rb');
59
60
        while (($line = fgets($resource)) !== false) {
61
            $this->write('<fg=green>'.$line.'</>');
62
        }
63
64
        fclose($resource);
65
    }
66
}
67