Passed
Push — master ( 92d243...5a69a1 )
by Eric
12:07
created

CoverageCheckStyle   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 55
rs 10
c 1
b 0
f 0
ccs 12
cts 12
cp 1
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A success() 0 4 2
A table() 0 11 1
A error() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of PHPUnit Coverage Check.
7
 *
8
 * (c) Eric Sizemore <[email protected]>
9
 * (c) Richard Regeer <[email protected]>
10
 *
11
 * This source file is subject to the MIT license. For the full copyright,
12
 * license information, and credits/acknowledgements, please view the LICENSE
13
 * and README files that were distributed with this source code.
14
 */
15
16
namespace Esi\CoverageCheck\Style;
17
18
use Symfony\Component\Console\Style\SymfonyStyle;
19
20
class CoverageCheckStyle extends SymfonyStyle
21
{
22
    /**
23
     * @see SymfonyStyle
24
     *
25
     * @inheritDoc
26
     *
27
     * Ignoring for now, may need to create a stub for PhpStan as Symfony's interface does not
28
     * specify array shape/iterable types.
29
     *
30
     * @phpstan-ignore missingType.iterableValue
31
     */
32 8
    #[\Override]
33
    public function error(string|array $message, bool $onlyPercentage = false): void
34
    {
35 8
        $this->block($message, ($onlyPercentage ? null : 'ERROR'), 'fg=white;bg=red', ' ', true);
36
    }
37
38
    /**
39
     * @see SymfonyStyle
40
     *
41
     * @inheritDoc
42
     *
43
     * Ignoring for now, may need to create a stub for PhpStan as Symfony's interface does not
44
     * specify array shape/iterable types.
45
     *
46
     * @phpstan-ignore missingType.iterableValue
47
     */
48 2
    #[\Override]
49
    public function success(string|array $message, bool $onlyPercentage = false): void
50
    {
51 2
        $this->block($message, ($onlyPercentage ? null : 'OK'), 'fg=black;bg=green', ' ', true);
52
    }
53
54
    /**
55
     * @see SymfonyStyle
56
     *
57
     * @inheritDoc
58
     *
59
     * Ignoring for now, may need to create a stub for PhpStan as Symfony's interface does not
60
     * specify array shape/iterable types.
61
     *
62
     * @phpstan-ignore missingType.iterableValue, missingType.iterableValue
63
     */
64 2
    #[\Override]
65
    public function table(array $headers, array $rows): void
66
    {
67 2
        $this->createTable()
68 2
            ->setHeaders($headers)
69 2
            ->setRows($rows)
70 2
            ->setColumnMaxWidth(0, 70)
71 2
            ->render()
72 2
        ;
73
74 2
        $this->newLine();
75
    }
76
}
77