@@ -47,10 +47,10 @@ public function build(CodeCoverage $coverage)
4747 private function addItems (Directory $ root , array $ items , array $ tests , $ cacheTokens )
4848 {
4949 foreach ($ items as $ key => $ value ) {
50- if (substr ($ key , -2 ) == '/f ' ) {
51- $ key = substr ($ key , 0 , -2 );
50+ if (\ substr ($ key , -2 ) == '/f ' ) {
51+ $ key = \ substr ($ key , 0 , -2 );
5252
53- if (file_exists ($ root ->getPath () . DIRECTORY_SEPARATOR . $ key )) {
53+ if (\ file_exists ($ root ->getPath () . DIRECTORY_SEPARATOR . $ key )) {
5454 $ root ->addFile ($ key , $ value , $ tests , $ cacheTokens );
5555 }
5656 } else {
@@ -109,9 +109,9 @@ private function buildDirectoryStructure($files)
109109 $ result = [];
110110
111111 foreach ($ files as $ path => $ file ) {
112- $ path = explode ('/ ' , $ path );
112+ $ path = \ explode ('/ ' , $ path );
113113 $ pointer = &$ result ;
114- $ max = count ($ path );
114+ $ max = \ count ($ path );
115115
116116 for ($ i = 0 ; $ i < $ max ; $ i ++) {
117117 if ($ i == ($ max - 1 )) {
@@ -177,41 +177,42 @@ private function reducePaths(&$files)
177177 }
178178
179179 $ commonPath = '' ;
180- $ paths = array_keys ($ files );
180+ $ paths = \ array_keys ($ files );
181181
182- if (count ($ files ) == 1 ) {
183- $ commonPath = dirname ($ paths [0 ]) . '/ ' ;
184- $ files [basename ($ paths [0 ])] = $ files [$ paths [0 ]];
182+ if (\ count ($ files ) == 1 ) {
183+ $ commonPath = \ dirname ($ paths [0 ]) . '/ ' ;
184+ $ files [\ basename ($ paths [0 ])] = $ files [$ paths [0 ]];
185185
186186 unset($ files [$ paths [0 ]]);
187187
188188 return $ commonPath ;
189189 }
190190
191- $ max = count ($ paths );
191+ $ max = \ count ($ paths );
192192
193193 for ($ i = 0 ; $ i < $ max ; $ i ++) {
194194 // strip phar:// prefixes
195- if (strpos ($ paths [$ i ], 'phar:// ' ) === 0 ) {
196- $ paths [$ i ] = substr ($ paths [$ i ], 7 );
197- $ paths [$ i ] = strtr ($ paths [$ i ], '/ ' , DIRECTORY_SEPARATOR );
195+ if (\ strpos ($ paths [$ i ], 'phar:// ' ) === 0 ) {
196+ $ paths [$ i ] = \ substr ($ paths [$ i ], 7 );
197+ $ paths [$ i ] = \ strtr ($ paths [$ i ], '/ ' , DIRECTORY_SEPARATOR );
198198 }
199- $ paths [$ i ] = explode (DIRECTORY_SEPARATOR , $ paths [$ i ]);
199+ $ paths [$ i ] = \ explode (DIRECTORY_SEPARATOR , $ paths [$ i ]);
200200
201201 if (empty ($ paths [$ i ][0 ])) {
202202 $ paths [$ i ][0 ] = DIRECTORY_SEPARATOR ;
203203 }
204204 }
205205
206206 $ done = false ;
207- $ max = count ($ paths );
207+ $ max = \ count ($ paths );
208208
209209 while (!$ done ) {
210210 for ($ i = 0 ; $ i < $ max - 1 ; $ i ++) {
211211 if (!isset ($ paths [$ i ][0 ]) ||
212212 !isset ($ paths [$ i + 1 ][0 ]) ||
213213 $ paths [$ i ][0 ] != $ paths [$ i + 1 ][0 ]) {
214214 $ done = true ;
215+
215216 break ;
216217 }
217218 }
@@ -224,21 +225,21 @@ private function reducePaths(&$files)
224225 }
225226
226227 for ($ i = 0 ; $ i < $ max ; $ i ++) {
227- array_shift ($ paths [$ i ]);
228+ \ array_shift ($ paths [$ i ]);
228229 }
229230 }
230231 }
231232
232- $ original = array_keys ($ files );
233- $ max = count ($ original );
233+ $ original = \ array_keys ($ files );
234+ $ max = \ count ($ original );
234235
235236 for ($ i = 0 ; $ i < $ max ; $ i ++) {
236- $ files [implode ('/ ' , $ paths [$ i ])] = $ files [$ original [$ i ]];
237+ $ files [\ implode ('/ ' , $ paths [$ i ])] = $ files [$ original [$ i ]];
237238 unset($ files [$ original [$ i ]]);
238239 }
239240
240- ksort ($ files );
241+ \ ksort ($ files );
241242
242- return substr ($ commonPath , 0 , -1 );
243+ return \ substr ($ commonPath , 0 , -1 );
243244 }
244245}
0 commit comments