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

getValidatedFilesList() private method

Either we have a zip that contains 1 parent directory with files inside (directory not necessarily named like the theme) and we extract those files. Or we have a zip that directly contains the theme files and we should prepend them with the theme folder.
private getValidatedFilesList ( ZipArchive $zip ) : String[]
$zip ZipArchive
return String[]
    private function getValidatedFilesList($zip)
    {
        $this->parentFolderName = $this->extractFolderNameBasedOnInfoFile($this->infoFilePath);
        // Check every file in the zip
        $files = array();
        for ($i = 0; $i < $zip->numFiles; ++$i) {
            // Get the file name
            $file = $zip->statIndex($i);
            $fileName = $file['name'];
            // We skip all the files that are outside of the theme folder or on the ignore list.
            if ($this->checkIfPathContainsIgnoredWord($fileName) || !empty($this->parentFolderName) && mb_stripos($fileName, $this->parentFolderName) !== 0) {
                continue;
            }
            $files[] = $fileName;
        }
        return $files;
    }