Total Complexity | 14 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | final class System |
||
18 | { |
||
19 | /** |
||
20 | * Return true if PHP running in CLI mode. |
||
21 | * |
||
22 | * @codeCoverageIgnore |
||
23 | * @return bool |
||
24 | */ |
||
25 | public static function isCLI(): bool |
||
26 | { |
||
27 | if (!empty(getenv('RR'))) { |
||
28 | // Do not treat RoadRunner as CLI. |
||
29 | return false; |
||
30 | } |
||
31 | |||
32 | if (php_sapi_name() === 'cli') { |
||
33 | return true; |
||
34 | } |
||
35 | |||
36 | return false; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * Returns true if the STDOUT supports colorization. |
||
41 | * |
||
42 | * @codeCoverageIgnore |
||
43 | * @link https://github.com/symfony/Console/blob/master/Output/StreamOutput.php#L94 |
||
44 | * @param mixed $stream |
||
45 | * @return bool |
||
46 | */ |
||
47 | public static function isColorsSupported($stream = STDOUT): bool |
||
77 | } |
||
78 | } |
||
80 |