Chumper\Zipper\Zipper::extractTo PHP Method

extractTo() public method

Extracts the opened zip archive to the specified location
you can provide an array of files and folders and define if they should be a white list or a black list to extract.
public extractTo ( $path, array $files = [], integer $method = Zipper::BLACKLIST )
$path string The path to extract to
$files array An array of files
$method integer The Method the files should be treated
    public function extractTo($path, array $files = array(), $method = Zipper::BLACKLIST)
    {
        if (!$this->file->exists($path)) {
            $this->file->makeDirectory($path, 0755, true);
        }
        if ($method == Zipper::WHITELIST) {
            $this->extractWithWhiteList($path, $files);
        } else {
            $this->extractWithBlackList($path, $files);
        }
    }

Usage Example

Beispiel #1
0
 public function testExtractBlackList()
 {
     $this->file->shouldReceive('isFile')->with('foo')->andReturn(true);
     $this->archive->add('foo');
     $this->file->shouldReceive('put')->with(realpath(NULL) . '/foo', 'foo');
     $this->archive->extractTo(getcwd(), array(), Zipper::BLACKLIST);
     //----
     $this->file->shouldReceive('isFile')->with('foo')->andReturn(true);
     $this->archive->folder('foo/bar')->add('foo');
     $this->file->shouldReceive('put')->with(realpath(NULL) . '/foo', 'foo/bar/foo');
     $this->archive->extractTo(getcwd(), array('foo'), Zipper::BLACKLIST);
 }
All Usage Examples Of Chumper\Zipper\Zipper::extractTo