public function extract($source)
    {
        $tmpDirectory = null;

        $this->assertSourceAsFile($source);
        $folder = \tao_helpers_File::createTempDir();
        $zip = new ZipArchive();
        if ($zip->open($source) === true) {
            if (\tao_helpers_File::checkWhetherArchiveIsBomb($zip)) {
                throw new PortableElementExtractException(sprintf('Source %s seems to be a ZIP bomb', $source));
            }
            if($zip->extractTo($folder)){
                $tmpDirectory = $folder;
            }
            $zip->close();
        }

        if (! is_dir($tmpDirectory)) {
            throw new PortableElementExtractException('Unable to extract portable element.');
        }

        return $tmpDirectory;
    }
public function extract($source)
    {
        $tmpDirectory = null;

        $this->assertSourceAsFile($source);
        $folder = \tao_helpers_File::createTempDir();
        $zip = new ZipArchive();
        if ($zip->open($source) === true) {
            if (\tao_helpers_File::checkWhetherArchiveIsBomb($zip)) {
                throw new PortableElementExtractException(sprintf('Source %s seems to be a ZIP bomb', $source));
            }
            if($zip->extractTo($folder)){
                $tmpDirectory = $folder;
            }
            $zip->close();
        }

        if (! is_dir($tmpDirectory)) {
            throw new PortableElementExtractException('Unable to extract portable element.');
        }

        return $tmpDirectory;
    }
public function extract ( $ source ) { $ tmpDirectory = null ; $ this -> assertSourceAsFile ( $ source ) ; $ folder = \ tao_helpers_File :: createTempDir ( ) ; $ zip = new ZipArchive ( ) ; if ( $ zip -> open ( $ source ) === true ) { if ( \ tao_helpers_File :: checkWhetherArchiveIsBomb ( $ zip ) ) { throw new PortableElementExtractException ( sprintf ( 'Source %s seems to be a ZIP bomb' , $ source ) ) ; } if ( $ zip -> extractTo ( $ folder ) ) { $ tmpDirectory = $ folder ; } $ zip -> close ( ) ; } if ( ! is_dir ( $ tmpDirectory ) ) { throw new PortableElementExtractException ( 'Unable to extract portable element.' ) ; } return $ tmpDirectory ; }
Extract zip package into temp directory

@param string $source Zip path
@return string Tmp directory to find extracted zip
@throws PortableElementExtractException
@throws common_Exception
Extract zip package into temp directory