Backend\Modules\Extensions\Actions\UploadTheme::findInfoFileInZip PHP Method

findInfoFileInZip() private method

Two ideal situations possible: we have a zip with files including info.xml, or we have a zip with the theme-folder.
private findInfoFileInZip ( ZipArchive $zip ) : string
$zip ZipArchive
return string
    private function findInfoFileInZip(ZipArchive $zip)
    {
        for ($i = 0; $i < $zip->numFiles; $i++) {
            if (mb_stripos($zip->getNameIndex($i), self::INFO_FILE) !== false) {
                $infoFile = $zip->statIndex($i);
                // Check that the file is not found inside a directory to ignore.
                if ($this->checkIfPathContainsIgnoredWord($infoFile['name'])) {
                    continue;
                }
                $this->infoFilePath = $infoFile['name'];
                $this->info = $zip->getFromName($infoFile['name']);
                break;
            }
        }
        return $this->info;
    }