public function resolveFile($file) { if (!is_file($file)) { throw new \yii\base\Exception('Source file not found.'); } if (!class_exists('\\ZipArchive')) { throw new \yii\base\Exception('Not exist ZipArchive class, your must install PECL zip library.'); } $z = new \ZipArchive(); $z->open($file); $z->extractTo($this->tmpPath); $z->close(); $files = FileHelper::findFiles($this->tmpPath); $names = [self::CSV_FILE_LOCATION, self::CSV_FILE_BLOCKS]; foreach ($names as $name) { foreach ($files as $fileCsv) { if (!FileHelper::filterPath($fileCsv, ['only' => [$name], 'basePath' => realpath($fileCsv)])) { continue; } $this->resolveCsv($name, $fileCsv); } } }