| Total Complexity | 3 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 4 | class Colours |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * Foreground colours. |
||
| 8 | * |
||
| 9 | * @var array |
||
| 10 | */ |
||
| 11 | private static $FOREGROUND = [ |
||
| 12 | 'black' => '0;30', |
||
| 13 | 'dark_gray' => '1;30', |
||
| 14 | 'red' => '0;31', |
||
| 15 | 'light_red' => '1;31', |
||
| 16 | 'green' => '0;32', |
||
| 17 | 'light_green' => '1;32', |
||
| 18 | 'yellow' => '0;33', |
||
| 19 | 'light_yellow' => '1;33', |
||
| 20 | 'blue' => '0;34', |
||
| 21 | 'light_blue' => '1;34', |
||
| 22 | 'purple' => '0;35', |
||
| 23 | 'light_purple' => '1:35', |
||
| 24 | 'cyan' => '0:36', |
||
| 25 | 'light_cyan' => '1;36', |
||
| 26 | 'light_gray' => '0;37', |
||
| 27 | 'white' => '1;37', |
||
| 28 | ]; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Background colours. |
||
| 32 | * |
||
| 33 | * @var array |
||
| 34 | */ |
||
| 35 | private static $BACKGROUND = [ |
||
| 36 | 'black' => '40', |
||
| 37 | 'red' => '41', |
||
| 38 | 'green' => '42', |
||
| 39 | 'yellow' => '43', |
||
| 40 | 'blue' => '44', |
||
| 41 | 'magenta' => '45', |
||
| 42 | 'cyan' => '46', |
||
| 43 | 'light_gray' => '47', |
||
| 44 | ]; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Colourize string. |
||
| 48 | * |
||
| 49 | * @param string $string string to colourize |
||
| 50 | * @param string $foreground foreground colour |
||
| 51 | * @param string $background background colour |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | final public function setColour($string, $foreground = null, $background = null) |
||
| 62 |