File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 4
4
* Text Color Writer
5
5
*
6
6
* Thanks Thijs Lensselink
7
+ *
7
8
* @link http://blog.lenss.nl/2012/05/adding-colors-to-php-cli-script-output/
8
9
*/
9
10
class TextColorWriter
@@ -20,6 +21,7 @@ class TextColorWriter
20
21
*
21
22
* @param string $string
22
23
* @param int $colorID
24
+ *
23
25
* @return string
24
26
*/
25
27
public static function textColor ($ string , $ colorID )
@@ -28,7 +30,7 @@ public static function textColor($string, $colorID)
28
30
throw new Exception ("Error unknown color ID $ colorID " );
29
31
}
30
32
31
- $ colorChar = "\033[ " . $ colorID. "m " ;
33
+ $ colorChar = "\033[ " . $ colorID . "m " ;
32
34
$ coloredString = $ colorChar . $ string . "\033[0m " ;
33
35
34
36
return $ coloredString ;
Original file line number Diff line number Diff line change @@ -48,19 +48,19 @@ function validateInput($argv)
48
48
require 'Util/TextColorWriter.php ' ;
49
49
50
50
// parse url
51
- $ url = $ argv [1 ];
52
- $ GETParts = explode ('& ' , $ url );
51
+ $ url = $ argv [1 ];
52
+ $ GETParts = explode ('& ' , $ url );
53
53
$ pathParts = explode ('? ' , $ GETParts [0 ]);
54
54
55
- $ path = $ pathParts [0 ];
55
+ $ path = $ pathParts [0 ];
56
56
$ firstParameter = $ pathParts [1 ];
57
57
$ moreParameters = array_slice ($ GETParts , 1 );
58
- $ parameters = array_merge (array ($ firstParameter ), $ moreParameters );
58
+ $ parameters = array_merge (array ($ firstParameter ), $ moreParameters );
59
59
60
60
// echo result
61
61
echo TextColorWriter::textColor ('URL ANALYSIS: ' , TextColorWriter::BASH_PROMPT_GREEN ) . PHP_EOL ;
62
- echo TextColorWriter::textColor ('Path: ' , TextColorWriter::BASH_PROMPT_BLUE ). ' ' . $ path . PHP_EOL ;
63
- echo TextColorWriter::textColor ('GET parameters: ' , TextColorWriter::BASH_PROMPT_BLUE ). PHP_EOL ;
62
+ echo TextColorWriter::textColor ('Path: ' , TextColorWriter::BASH_PROMPT_BLUE ) . ' ' . $ path . PHP_EOL ;
63
+ echo TextColorWriter::textColor ('GET parameters: ' , TextColorWriter::BASH_PROMPT_BLUE ) . PHP_EOL ;
64
64
65
65
$ urldecode = isset ($ argv [2 ]);
66
66
You can’t perform that action at this time.
0 commit comments