11<?php
2- namespace jblond ;
2+ namespace jblond \ cli ;
33
44/**
5- * Class cli_colors
5+ * Class CliColors
66 *
7- * works on bash
8- *
9- * @package jblond
7+ * Works on bash
8+ * @package jblond\helper
109 */
11- class cli_colors {
10+ class CliColors {
1211
1312 /**
1413 * @var array
1514 */
16- private $ foreground_colors = array (
15+ private $ foregroundColors = array (
1716 'black ' => '0;30 ' ,
1817 'dark_gray ' => '1;30 ' ,
1918 'blue ' => '0,34 ' ,
@@ -35,7 +34,7 @@ class cli_colors {
3534 /**
3635 * @var array
3736 */
38- private $ background_colors = array (
37+ private $ backgroundColors = array (
3938 'black ' => '40 ' ,
4039 'red ' => '41 ' ,
4140 'green ' => '42 ' ,
@@ -46,25 +45,24 @@ class cli_colors {
4645 'light_gray ' => '47 '
4746 );
4847
49-
5048 /**
5149 * @param string $string
5250 * @param null|string $foreground_color
5351 * @param null|string $background_color
5452 * @return string
5553 */
56- public function get_colored_string ($ string , $ foreground_color = null , $ background_color = null ){
54+ public function getColoredString ($ string , $ foreground_color = null , $ background_color = null ){
5755 $ colored_string = '' ;
5856
59- if (isset ($ this ->foreground_colors ["$ foreground_color " ])){
60- $ colored_string .= "\033[ " . $ this ->foreground_colors [$ foreground_color ] . "m " ;
57+ if (isset ($ this ->foregroundColors ["$ foreground_color " ])){
58+ $ colored_string .= "\033[ " . $ this ->foregroundColors [$ foreground_color ] . "m " ;
6159 }
6260
63- if (isset ($ this ->background_colors ["$ background_color " ])){
64- $ colored_string .= "\033[ " . $ this ->background_colors [$ background_color ] . "m " ;
61+ if (isset ($ this ->backgroundColors ["$ background_color " ])){
62+ $ colored_string .= "\033[ " . $ this ->backgroundColors [$ background_color ] . "m " ;
6563 }
6664
67- $ colored_string .= $ string . "\033[0m " ;
65+ $ colored_string .= $ string . "\033[0m " ;
6866 return $ colored_string ;
6967 }
7068
@@ -73,17 +71,16 @@ public function get_colored_string($string, $foreground_color = null, $backgroun
7371 *
7472 * @return array
7573 */
76- public function get_foreground_colors () {
77- return array_keys ($ this ->foreground_colors );
74+ public function getForegroundColors () {
75+ return array_keys ($ this ->foregroundColors );
7876 }
7977
80-
8178 /**
8279 * Returns all background color names
8380 *
8481 * @return array
8582 */
86- public function get_background_colors () {
87- return array_keys ($ this ->background_colors );
83+ public function getBackgroundColors () {
84+ return array_keys ($ this ->backgroundColors );
8885 }
8986}
0 commit comments