From abfefd1faae02a72dfa1259440fdf6d7305af736 Mon Sep 17 00:00:00 2001 From: Danack Date: Sun, 18 Aug 2013 22:57:26 +0100 Subject: [PATCH] Improved variable name. --- src/Composer/Repository/ArtifactRepository.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Composer/Repository/ArtifactRepository.php b/src/Composer/Repository/ArtifactRepository.php index e554cac8b..769e35b40 100644 --- a/src/Composer/Repository/ArtifactRepository.php +++ b/src/Composer/Repository/ArtifactRepository.php @@ -82,29 +82,25 @@ class ArtifactRepository extends ArrayRepository * @return bool|int */ private function locateFile(\ZipArchive $zip, $filename) { - $shortestIndex = -1; - $shortestIndexLength = -1; + $indexOfShortestMatch = false; + $lengthOfShortestMatch = -1; for ($i = 0; $i < $zip->numFiles; $i++ ){ $stat = $zip->statIndex($i); if (strcmp(basename($stat['name']), $filename) === 0){ $length = strlen($stat['name']); - if ($shortestIndex == -1 || $length < $shortestIndexLength) { + if ($indexOfShortestMatch == false || $length < $lengthOfShortestMatch) { //Check it's not a directory. $contents = $zip->getFromIndex($i); if ($contents !== false) { - $shortestIndex = $i; - $shortestIndexLength = $length; + $indexOfShortestMatch = $i; + $lengthOfShortestMatch = $length; } } } } - if ($shortestIndex == -1) { - return false; - } - - return $shortestIndex; + return $indexOfShortestMatch; } private function getComposerInformation(\SplFileInfo $file)