22
33class PrinterInit
44{
5- const GREEN = "\e[32m " ;
6- const RESET = "\e[0m " ;
7- const CYAN = "\e[36m " ;
8- const RED = "\e[31m " ;
9- const YELLOW = "\033[0;33m " ;
5+ const GREEN = "\e[32m " ;
6+ const RESET = "\e[0m " ;
7+ const CYAN = "\e[36m " ;
8+ const RED = "\e[31m " ;
9+ const YELLOW = "\033[0;33m " ;
1010 const LYELLOW = "\033[33;01m " ;
11- const WHITE = "\033[0;37m " ;
12- const LWHITE = "\033[37;01m " ;
11+ const WHITE = "\033[0;37m " ;
12+ const LWHITE = "\033[37;01m " ;
1313 const MAGENTA = "\033[2;35m " ;
1414
1515 public function __construct ()
@@ -20,7 +20,7 @@ public function init(string $use_colors = 'never', array $options = []): int
2020 {
2121 $ result = 0 ;
2222
23- $ useCollision = in_array (" --collision " , $ options );
23+ $ useCollision = in_array (' --collision ' , $ options );
2424
2525 $ phpunit_xml_file = './phpunit.xml ' ;
2626 if (!file_exists ($ phpunit_xml_file )) {
@@ -30,7 +30,7 @@ public function init(string $use_colors = 'never', array $options = []): int
3030 echo "\n " .self ::LWHITE .'[• ] ' .self ::GREEN ." Gathering installation details \n" .self ::RESET ;
3131 $ result = $ this ->add_printer_class_to_phpunit_xml ($ phpunit_xml_file );
3232 if ($ useCollision ) {
33- if (is_dir (" vendor/nunomaduro/collision " )) {
33+ if (is_dir (' vendor/nunomaduro/collision ' )) {
3434 $ result = $ this ->add_collision_to_phpunit_xml ($ phpunit_xml_file );
3535 if ($ result === 0 ) {
3636 echo self ::GREEN ." ✔ Collision listener activated \n" .self ::RESET ;
@@ -51,7 +51,7 @@ private function add_printer_class_to_phpunit_xml(string $file = './phpunit.xml'
5151 {
5252 $ PHPUNIT_FILE = $ file ;
5353 if (file_exists ($ PHPUNIT_FILE )) {
54- $ data = file_get_contents ($ PHPUNIT_FILE );
54+ $ data = file_get_contents ($ PHPUNIT_FILE );
5555 $ result = (int ) strpos ($ data , 'printerClass= ' );
5656 if ($ result > 0 ) {
5757 echo self ::LWHITE .' [•• ] ' .self ::LYELLOW .' Printer class already configured in ' .self ::CYAN ."{$ PHPUNIT_FILE } \n" .self ::RESET ;
@@ -79,13 +79,14 @@ private function add_collision_to_phpunit_xml(string $file = './phpunit.xml'): i
7979</listeners>
8080 ' ;
8181 $ data = file_get_contents ($ file );
82- $ pos = strpos ($ data , " Collision " );
82+ $ pos = strpos ($ data , ' Collision ' );
8383 if (!$ pos ) {
84- $ pos = strpos ($ data , " <filter> " );
84+ $ pos = strpos ($ data , ' <filter> ' );
8585 if ($ pos > 0 ) {
8686 $ data = substr_replace ($ data , $ collisionData , $ pos , 0 );
8787 file_put_contents ($ file , $ data );
88- return 0 ;//all good, no errors
88+
89+ return 0 ; //all good, no errors
8990 } else {
9091 return -43 ;
9192 }
@@ -96,7 +97,7 @@ private function add_collision_to_phpunit_xml(string $file = './phpunit.xml'): i
9697
9798 private function copy_default_settings (string $ file = 'phpunit-printer.yml ' )
9899 {
99- $ CONFIG_FILE = $ file ;
100+ $ CONFIG_FILE = $ file ;
100101 $ packageDefaultSettingFile = dirname (__FILE__ , 2 ).DIRECTORY_SEPARATOR .'src/ ' .$ CONFIG_FILE ;
101102
102103 $ copySettingFile = $ CONFIG_FILE ;
0 commit comments