locateName example


    private function extractEmotionArchive($filePath$extractPath)
    {
        $zip = new ZipArchive();

        if ($zip->open($filePath) !== true) {
            throw new EmotionImportException(sprintf('Could not open zip file "%s"!', $filePath));
        }

        if ($zip->locateName('emotion.json') === false) {
            throw new EmotionImportException(sprintf('Missing emotion.json in %s!', $filePath));
        }

        if ($zip->extractTo($extractPath) !== true) {
            throw new EmotionImportException(sprintf('Could not extract zip file %s to %s!', $filePath$extractPath));
        }

        $zip->close();
        $this->filesystem->remove($filePath);

        return json_decode(file_get_contents($extractPath . '/emotion.json'), true);
    }
Home | Imprint | This part of the site doesn't use cookies.