Improved variable name.
parent
74b4bcd22e
commit
abfefd1faa
|
@ -82,29 +82,25 @@ class ArtifactRepository extends ArrayRepository
|
||||||
* @return bool|int
|
* @return bool|int
|
||||||
*/
|
*/
|
||||||
private function locateFile(\ZipArchive $zip, $filename) {
|
private function locateFile(\ZipArchive $zip, $filename) {
|
||||||
$shortestIndex = -1;
|
$indexOfShortestMatch = false;
|
||||||
$shortestIndexLength = -1;
|
$lengthOfShortestMatch = -1;
|
||||||
|
|
||||||
for ($i = 0; $i < $zip->numFiles; $i++ ){
|
for ($i = 0; $i < $zip->numFiles; $i++ ){
|
||||||
$stat = $zip->statIndex($i);
|
$stat = $zip->statIndex($i);
|
||||||
if (strcmp(basename($stat['name']), $filename) === 0){
|
if (strcmp(basename($stat['name']), $filename) === 0){
|
||||||
$length = strlen($stat['name']);
|
$length = strlen($stat['name']);
|
||||||
if ($shortestIndex == -1 || $length < $shortestIndexLength) {
|
if ($indexOfShortestMatch == false || $length < $lengthOfShortestMatch) {
|
||||||
//Check it's not a directory.
|
//Check it's not a directory.
|
||||||
$contents = $zip->getFromIndex($i);
|
$contents = $zip->getFromIndex($i);
|
||||||
if ($contents !== false) {
|
if ($contents !== false) {
|
||||||
$shortestIndex = $i;
|
$indexOfShortestMatch = $i;
|
||||||
$shortestIndexLength = $length;
|
$lengthOfShortestMatch = $length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($shortestIndex == -1) {
|
return $indexOfShortestMatch;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $shortestIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getComposerInformation(\SplFileInfo $file)
|
private function getComposerInformation(\SplFileInfo $file)
|
||||||
|
|
Loading…
Reference in New Issue