2
2
3
3
class PrinterInit
4
4
{
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 " ;
10
10
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 " ;
13
13
const MAGENTA = "\033[2;35m " ;
14
14
15
15
public function __construct ()
@@ -20,7 +20,7 @@ public function init(string $use_colors = 'never', array $options = []): int
20
20
{
21
21
$ result = 0 ;
22
22
23
- $ useCollision = in_array (" --collision " , $ options );
23
+ $ useCollision = in_array (' --collision ' , $ options );
24
24
25
25
$ phpunit_xml_file = './phpunit.xml ' ;
26
26
if (!file_exists ($ phpunit_xml_file )) {
@@ -30,7 +30,7 @@ public function init(string $use_colors = 'never', array $options = []): int
30
30
echo "\n " .self ::LWHITE .'[• ] ' .self ::GREEN ." Gathering installation details \n" .self ::RESET ;
31
31
$ result = $ this ->add_printer_class_to_phpunit_xml ($ phpunit_xml_file );
32
32
if ($ useCollision ) {
33
- if (is_dir (" vendor/nunomaduro/collision " )) {
33
+ if (is_dir (' vendor/nunomaduro/collision ' )) {
34
34
$ result = $ this ->add_collision_to_phpunit_xml ($ phpunit_xml_file );
35
35
if ($ result === 0 ) {
36
36
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'
51
51
{
52
52
$ PHPUNIT_FILE = $ file ;
53
53
if (file_exists ($ PHPUNIT_FILE )) {
54
- $ data = file_get_contents ($ PHPUNIT_FILE );
54
+ $ data = file_get_contents ($ PHPUNIT_FILE );
55
55
$ result = (int ) strpos ($ data , 'printerClass= ' );
56
56
if ($ result > 0 ) {
57
57
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
79
79
</listeners>
80
80
' ;
81
81
$ data = file_get_contents ($ file );
82
- $ pos = strpos ($ data , " Collision " );
82
+ $ pos = strpos ($ data , ' Collision ' );
83
83
if (!$ pos ) {
84
- $ pos = strpos ($ data , " <filter> " );
84
+ $ pos = strpos ($ data , ' <filter> ' );
85
85
if ($ pos > 0 ) {
86
86
$ data = substr_replace ($ data , $ collisionData , $ pos , 0 );
87
87
file_put_contents ($ file , $ data );
88
- return 0 ;//all good, no errors
88
+
89
+ return 0 ; //all good, no errors
89
90
} else {
90
91
return -43 ;
91
92
}
@@ -96,7 +97,7 @@ private function add_collision_to_phpunit_xml(string $file = './phpunit.xml'): i
96
97
97
98
private function copy_default_settings (string $ file = 'phpunit-printer.yml ' )
98
99
{
99
- $ CONFIG_FILE = $ file ;
100
+ $ CONFIG_FILE = $ file ;
100
101
$ packageDefaultSettingFile = dirname (__FILE__ , 2 ).DIRECTORY_SEPARATOR .'src/ ' .$ CONFIG_FILE ;
101
102
102
103
$ copySettingFile = $ CONFIG_FILE ;
0 commit comments