@@ -47,10 +47,10 @@ public function build(CodeCoverage $coverage)
47
47
private function addItems (Directory $ root , array $ items , array $ tests , $ cacheTokens )
48
48
{
49
49
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 );
52
52
53
- if (file_exists ($ root ->getPath () . DIRECTORY_SEPARATOR . $ key )) {
53
+ if (\ file_exists ($ root ->getPath () . DIRECTORY_SEPARATOR . $ key )) {
54
54
$ root ->addFile ($ key , $ value , $ tests , $ cacheTokens );
55
55
}
56
56
} else {
@@ -109,9 +109,9 @@ private function buildDirectoryStructure($files)
109
109
$ result = [];
110
110
111
111
foreach ($ files as $ path => $ file ) {
112
- $ path = explode ('/ ' , $ path );
112
+ $ path = \ explode ('/ ' , $ path );
113
113
$ pointer = &$ result ;
114
- $ max = count ($ path );
114
+ $ max = \ count ($ path );
115
115
116
116
for ($ i = 0 ; $ i < $ max ; $ i ++) {
117
117
if ($ i == ($ max - 1 )) {
@@ -177,41 +177,42 @@ private function reducePaths(&$files)
177
177
}
178
178
179
179
$ commonPath = '' ;
180
- $ paths = array_keys ($ files );
180
+ $ paths = \ array_keys ($ files );
181
181
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 ]];
185
185
186
186
unset($ files [$ paths [0 ]]);
187
187
188
188
return $ commonPath ;
189
189
}
190
190
191
- $ max = count ($ paths );
191
+ $ max = \ count ($ paths );
192
192
193
193
for ($ i = 0 ; $ i < $ max ; $ i ++) {
194
194
// 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 );
198
198
}
199
- $ paths [$ i ] = explode (DIRECTORY_SEPARATOR , $ paths [$ i ]);
199
+ $ paths [$ i ] = \ explode (DIRECTORY_SEPARATOR , $ paths [$ i ]);
200
200
201
201
if (empty ($ paths [$ i ][0 ])) {
202
202
$ paths [$ i ][0 ] = DIRECTORY_SEPARATOR ;
203
203
}
204
204
}
205
205
206
206
$ done = false ;
207
- $ max = count ($ paths );
207
+ $ max = \ count ($ paths );
208
208
209
209
while (!$ done ) {
210
210
for ($ i = 0 ; $ i < $ max - 1 ; $ i ++) {
211
211
if (!isset ($ paths [$ i ][0 ]) ||
212
212
!isset ($ paths [$ i + 1 ][0 ]) ||
213
213
$ paths [$ i ][0 ] != $ paths [$ i + 1 ][0 ]) {
214
214
$ done = true ;
215
+
215
216
break ;
216
217
}
217
218
}
@@ -224,21 +225,21 @@ private function reducePaths(&$files)
224
225
}
225
226
226
227
for ($ i = 0 ; $ i < $ max ; $ i ++) {
227
- array_shift ($ paths [$ i ]);
228
+ \ array_shift ($ paths [$ i ]);
228
229
}
229
230
}
230
231
}
231
232
232
- $ original = array_keys ($ files );
233
- $ max = count ($ original );
233
+ $ original = \ array_keys ($ files );
234
+ $ max = \ count ($ original );
234
235
235
236
for ($ i = 0 ; $ i < $ max ; $ i ++) {
236
- $ files [implode ('/ ' , $ paths [$ i ])] = $ files [$ original [$ i ]];
237
+ $ files [\ implode ('/ ' , $ paths [$ i ])] = $ files [$ original [$ i ]];
237
238
unset($ files [$ original [$ i ]]);
238
239
}
239
240
240
- ksort ($ files );
241
+ \ ksort ($ files );
241
242
242
- return substr ($ commonPath , 0 , -1 );
243
+ return \ substr ($ commonPath , 0 , -1 );
243
244
}
244
245
}
0 commit comments