Total Complexity | 10 |
Total Lines | 66 |
Duplicated Lines | 0 % |
Coverage | 95.45% |
Changes | 0 |
1 | <?php |
||
13 | class ConsoleColour extends ConsoleColor |
||
14 | { |
||
15 | use DoesProcessException; |
||
16 | |||
17 | public const ESC_CHAR = "\033"; |
||
18 | |||
19 | /** @var bool */ |
||
20 | protected $force256Colors; |
||
21 | |||
22 | 52 | public function __construct(?bool $force256Colors = null) |
|
23 | { |
||
24 | 52 | parent::__construct(); |
|
25 | 52 | $this->force256Colors = $force256Colors ?? false; |
|
26 | 52 | } |
|
27 | |||
28 | 2 | public function force256Colors(): ConsoleColour |
|
34 | } |
||
35 | |||
36 | 2 | public function are256ColorsForced(): bool |
|
39 | } |
||
40 | |||
41 | 2 | public function are256ColorsSupported(): bool |
|
42 | { |
||
43 | return |
||
44 | 2 | $this->force256Colors ?: parent::are256ColorsSupported(); |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param array|string $style |
||
49 | * @param string $text |
||
50 | * @return string |
||
51 | * @throws \Throwable |
||
52 | */ |
||
53 | 2 | public function applyEscaped($style, $text): string |
|
60 | ); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param array|string $styles |
||
65 | * @param string $text |
||
66 | * @return string |
||
67 | * @throws \Throwable |
||
68 | */ |
||
69 | 38 | public function apply($styles, $text): string |
|
81 |