@@ -14,7 +14,7 @@ class Console
1414 */
1515 static public function log (string $ message )
1616 {
17- return fwrite (STDOUT , $ message . "\n" );
17+ return \ fwrite (STDOUT , $ message . "\n" );
1818 }
1919
2020 /**
@@ -27,7 +27,7 @@ static public function log(string $message)
2727 */
2828 static public function success (string $ message )
2929 {
30- return fwrite (STDOUT , "\033[32m " . $ message . "\033[0m \n" );
30+ return \ fwrite (STDOUT , "\033[32m " . $ message . "\033[0m \n" );
3131 }
3232
3333 /**
@@ -40,7 +40,7 @@ static public function success(string $message)
4040 */
4141 static public function error (string $ message )
4242 {
43- return fwrite (STDERR , "\033[31m " . $ message . "\033[0m \n" );
43+ return \ fwrite (STDERR , "\033[31m " . $ message . "\033[0m \n" );
4444 }
4545
4646 /**
@@ -52,7 +52,7 @@ static public function error(string $message)
5252 * @return bool|int
5353 */
5454 static public function info (string $ message ) {
55- return fwrite (STDOUT , "\033[34m " . $ message . "\033[0m \n" );
55+ return \ fwrite (STDOUT , "\033[34m " . $ message . "\033[0m \n" );
5656 }
5757
5858 /**
@@ -64,7 +64,7 @@ static public function info(string $message) {
6464 * @return bool|int
6565 */
6666 static public function warning (string $ message ) {
67- return fwrite (STDERR , "\033[1;33m " . $ message . "\033[0m \n" );
67+ return \ fwrite (STDERR , "\033[1;33m " . $ message . "\033[0m \n" );
6868 }
6969
7070 /**
@@ -78,10 +78,10 @@ static public function warning(string $message) {
7878 static public function confirm (string $ question ) {
7979 self ::log ($ question );
8080
81- $ handle = fopen ('php://stdin ' , 'r ' );
82- $ line = trim (fgets ($ handle ));
81+ $ handle = \ fopen ('php://stdin ' , 'r ' );
82+ $ line = \ trim (\ fgets ($ handle ));
8383
84- fclose ($ handle );
84+ \ fclose ($ handle );
8585
8686 return $ line ;
8787 }
@@ -94,46 +94,46 @@ static public function confirm(string $question) {
9494 static public function execute (string $ cmd , string $ stdin = null , string &$ stdout , string &$ stderr , int $ timeout = -1 ):int
9595 {
9696 $ pipes = [];
97- $ process = proc_open (
97+ $ process = \ proc_open (
9898 $ cmd ,
9999 [['pipe ' ,'r ' ],['pipe ' ,'w ' ],['pipe ' ,'w ' ]],
100100 $ pipes
101101 );
102- $ start = time ();
102+ $ start = \ time ();
103103 $ stdout = '' ;
104104 $ stderr = '' ;
105105
106- if (is_resource ($ process )) {
107- stream_set_blocking ($ pipes [0 ], 0 );
108- stream_set_blocking ($ pipes [1 ], 0 );
109- stream_set_blocking ($ pipes [2 ], 0 );
106+ if (\ is_resource ($ process )) {
107+ \ stream_set_blocking ($ pipes [0 ], 0 );
108+ \ stream_set_blocking ($ pipes [1 ], 0 );
109+ \ stream_set_blocking ($ pipes [2 ], 0 );
110110
111- fwrite ($ pipes [0 ], $ stdin );
112- fclose ($ pipes [0 ]);
111+ \ fwrite ($ pipes [0 ], $ stdin );
112+ \ fclose ($ pipes [0 ]);
113113 }
114114
115- while (is_resource ($ process ))
115+ while (\ is_resource ($ process ))
116116 {
117- $ stdout .= stream_get_contents ($ pipes [1 ]);
118- $ stderr .= stream_get_contents ($ pipes [2 ]);
117+ $ stdout .= \ stream_get_contents ($ pipes [1 ]);
118+ $ stderr .= \ stream_get_contents ($ pipes [2 ]);
119119
120- if ($ timeout > 0 && time () - $ start > $ timeout )
120+ if ($ timeout > 0 && \ time () - $ start > $ timeout )
121121 {
122- proc_terminate ($ process , 9 );
122+ \ proc_terminate ($ process , 9 );
123123 return 1 ;
124124 }
125125
126- $ status = proc_get_status ($ process );
126+ $ status = \ proc_get_status ($ process );
127127
128128 if (!$ status ['running ' ]) {
129- fclose ($ pipes [1 ]);
130- fclose ($ pipes [2 ]);
131- proc_close ($ process );
129+ \ fclose ($ pipes [1 ]);
130+ \ fclose ($ pipes [2 ]);
131+ \ proc_close ($ process );
132132
133133 return $ status ['exitcode ' ];
134134 }
135135
136- usleep (100000 );
136+ \ usleep (100000 );
137137 }
138138
139139 return 1 ;
0 commit comments