Pop\Archive\Archive::extract PHP Method

extract() public method

Method to extract an archived and/or compressed file
public extract ( string $to = null ) : Archive
$to string
return Archive
    public function extract($to = null)
    {
        $this->adapter->extract($to);
        return $this;
    }

Usage Example

Example #1
0
 public function testZipExtract()
 {
     if (class_exists('ZipArchive', false)) {
         $a = new Archive(__DIR__ . '/../tmp/test.zip');
         $a->addFiles(__DIR__ . '/../tmp');
         mkdir(__DIR__ . '/../tmp/test');
         chmod(__DIR__ . '/../tmp/test', 0777);
         chmod(__DIR__ . '/../tmp/test.zip', 0777);
         $a->extract(__DIR__ . '/../tmp/test');
         unset($a);
         $dir = new Dir(__DIR__ . '/../tmp/test');
         $this->assertGreaterThan(0, count($dir->getFiles()));
         $dir->emptyDir();
         rmdir(__DIR__ . '/../tmp/test');
         if (file_exists(__DIR__ . '/../tmp/test.zip')) {
             unlink(__DIR__ . '/../tmp/test.zip');
         }
     }
 }
All Usage Examples Of Pop\Archive\Archive::extract