src/Zip.php
protected function extractCustom($archive, $destination)
	{
		$this->data     = null;
		$this->metadata = null;

		$this->data = file_get_contents($archive);

		if (!$this->data)
		{
			throw new \RuntimeException('Unable to read archive');
		}

		if (!$this->readZipInfo($this->data))
		{
			throw new \RuntimeException('Get ZIP Information failed');
		}

		for ($i = 0, $n = \count($this->metadata); $i < $n; $i++)
		{
			$lastPathCharacter = substr($this->metadata[$i]['name'], -1, 1);

			if ($lastPathCharacter !== '/' && $lastPathCharacter !== '\\')
			{
				$buffer = $this->getFileData($i);
				$path   = Path::clean($destination . '/' . $this->metadata[$i]['name']);

				// Make sure the destination folder exists
				if (!Folder::create(\dirname($path)))
				{
					throw new \RuntimeException('Unable to create destination folder ' . \dirname($path));
				}

				if (!File::write($path, $buffer))
				{
					throw new \RuntimeException('Unable to write entry to file ' . $path);
				}
			}
		}

		return true;
	}
protected function extractCustom($archive, $destination)
	{
		$this->data     = null;
		$this->metadata = null;

		$this->data = file_get_contents($archive);

		if (!$this->data)
		{
			throw new \RuntimeException('Unable to read archive');
		}

		if (!$this->readZipInfo($this->data))
		{
			throw new \RuntimeException('Get ZIP Information failed');
		}

		for ($i = 0, $n = \count($this->metadata); $i < $n; $i++)
		{
			$lastPathCharacter = substr($this->metadata[$i]['name'], -1, 1);

			if ($lastPathCharacter !== '/' && $lastPathCharacter !== '\\')
			{
				$buffer = $this->getFileData($i);
				$path   = Path::clean($destination . '/' . $this->metadata[$i]['name']);

				// Make sure the destination folder exists
				if (!Folder::create(\dirname($path)))
				{
					throw new \RuntimeException('Unable to create destination folder ' . \dirname($path));
				}

				if (!File::write($path, $buffer))
				{
					throw new \RuntimeException('Unable to write entry to file ' . $path);
				}
			}
		}

		return true;
	}
protected function extractCustom ( $ archive , $ destination ) { $ this -> data = null ; $ this -> metadata = null ; $ this -> data = file_get_contents ( $ archive ) ; if ( ! $ this -> data ) { throw new \ RuntimeException ( 'Unable to read archive' ) ; } if ( ! $ this -> readZipInfo ( $ this -> data ) ) { throw new \ RuntimeException ( 'Get ZIP Information failed' ) ; } for ( $ i = 0 , $ n = \ count ( $ this -> metadata ) ; $ i < $ n ; $ i ++ ) { $ lastPathCharacter = substr ( $ this -> metadata [ $ i ] [ 'name' ] , - 1 , 1 ) ; if ( $ lastPathCharacter !== '/' && $ lastPathCharacter !== '\\' ) { $ buffer = $ this -> getFileData ( $ i ) ; $ path = Path :: clean ( $ destination . '/' . $ this -> metadata [ $ i ] [ 'name' ] ) ; // Make sure the destination folder exists if ( ! Folder :: create ( \ dirname ( $ path ) ) ) { throw new \ RuntimeException ( 'Unable to create destination folder ' . \ dirname ( $ path ) ) ; } if ( ! File :: write ( $ path , $ buffer ) ) { throw new \ RuntimeException ( 'Unable to write entry to file ' . $ path ) ; } } } return true ; }
Extract a ZIP compressed file to a given path using a php based algorithm that only requires zlib support

@param   string  $archive      Path to ZIP archive to extract.
@param   string  $destination  Path to extract archive into.

@return  boolean  True if successful

@since   1.0
@throws  \RuntimeException
Extract a ZIP compressed file to a given path using a php based algorithm that only requires zlib support