예제 #1
0
 public function execute($args)
 {
     if ($args) {
         $file = $args[0];
         if (file_exists($file) && \Clips\is_zip($file)) {
             switch (count($args)) {
                 case 1:
                     $p = new \ZipArchive();
                     $p->open($file);
                     for ($i = 0; $i < $p->numFiles; $i++) {
                         $stat = $p->statIndex($i);
                         echo $stat['name'] . PHP_EOL;
                         print_r($stat);
                     }
                     break;
                 default:
                     echo \Clips\zip_contents($file, $args[1]);
             }
         } else {
             $this->error("The file {$file} is not exists or is not a phar file!");
         }
     } else {
         $this->error('No phar file input!');
     }
 }
예제 #2
0
 public function testZipContents()
 {
     $path = Clips\try_path('test.zip');
     if ($path) {
         $this->assertNotNull(Clips\zip_contents($path, 'config.yml'));
     }
 }