archive() public method

Method to return the archive object within the adapter object
public archive ( ) : mixed
return mixed
Example #1
0
 public function testAdapter()
 {
     $tar = false;
     $includePath = explode(PATH_SEPARATOR, get_include_path());
     foreach ($includePath as $path) {
         if (file_exists($path . DIRECTORY_SEPARATOR . 'Archive' . DIRECTORY_SEPARATOR . 'Tar.php')) {
             $tar = true;
         }
     }
     if ($tar) {
         $a = Archive::factory(__DIR__ . '/../tmp/test.tar');
         $this->assertInstanceOf('Pop\\Archive\\Adapter\\Tar', $a->adapter());
         $this->assertInstanceOf('Archive_Tar', $a->archive());
         $files = $a->listFiles();
         $files = $a->listFiles(true);
         $this->assertTrue(is_array($files));
         if (file_exists(__DIR__ . '/../tmp/test.tar')) {
             unlink(__DIR__ . '/../tmp/test.tar');
         }
     }
     if (class_exists('ZipArchive', false)) {
         $a = new Archive('test.zip');
         $this->assertInstanceOf('Pop\\Archive\\Adapter\\Zip', $a->adapter());
         $this->assertInstanceOf('ZipArchive', $a->archive());
     }
 }