Archive/Archive.php
public function extract()
    {
        if (false === realpath($this->path)) {
            throw new \Exception(sprintf('Please provide a valid path instead of %s.', $this->path));
        }
        if (false === realpath($this->extractPath)) {
            throw new \Exception(sprintf('Please provide a valid path instead of %s.', $this->extractPath));
        }

        $zip = new \ZipArchive();

        if (null === $this->filename) {
            throw new \Exception('Impossible to extract an archive without a filename.');
        }

        $archive = sprintf('%s/%s', $this->path, $this->filename);
        if (true !== $zip->open($archive)) {
            throw new \Exception(sprintf('Impossible to open the archive %s.', $archive));
        }

        $zip->extractTo($this->extractPath);

        for ($i = 0; $i < $zip->numFiles; $i++) {
            $path = sprintf('%s/%s', $this->extractPath, $zip->getNameIndex($i));

            if (is_file($path)) {
                $this->files[] = new SplFileInfo($path);
            }
        }

        $zip->close();
        $this->cleanAndAddHeader();

        return $this;
    }
public function extract()
    {
        if (false === realpath($this->path)) {
            throw new \Exception(sprintf('Please provide a valid path instead of %s.', $this->path));
        }
        if (false === realpath($this->extractPath)) {
            throw new \Exception(sprintf('Please provide a valid path instead of %s.', $this->extractPath));
        }

        $zip = new \ZipArchive();

        if (null === $this->filename) {
            throw new \Exception('Impossible to extract an archive without a filename.');
        }

        $archive = sprintf('%s/%s', $this->path, $this->filename);
        if (true !== $zip->open($archive)) {
            throw new \Exception(sprintf('Impossible to open the archive %s.', $archive));
        }

        $zip->extractTo($this->extractPath);

        for ($i = 0; $i < $zip->numFiles; $i++) {
            $path = sprintf('%s/%s', $this->extractPath, $zip->getNameIndex($i));

            if (is_file($path)) {
                $this->files[] = new SplFileInfo($path);
            }
        }

        $zip->close();
        $this->cleanAndAddHeader();

        return $this;
    }
{@inheritdoc}