private static function locateFile(\ZipArchive $zip, $filename)
private static function locateFile(\ZipArchive $zip, $filename)
{
{
@ -85,8 +86,7 @@ class Zip
if ($dirname === '.') {
if ($dirname === '.') {
$topLevelPaths[$name] = true;
$topLevelPaths[$name] = true;
if (\count($topLevelPaths) > 1) {
if (\count($topLevelPaths) > 1) {
// archive can only contain one top level directory
throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
// archive can only contain one top level directory
throw new \RuntimeException('Archive has more than one top level directories, and no composer.json was found on the top level, so it\'s an invalid archive. Top level paths found were: '.implode(',', array_keys($topLevelPaths)));
return false;
}
}
}
}
}
}
@ -105,7 +104,6 @@ class Zip
return $index;
return $index;
}
}
// no composer.json found either at the top level or within the topmost directory
throw new \RuntimeException('No composer.json found either at the top level or within the topmost directory');