Exemple #1
0
 /**
  * Constructor.
  */
 public function __construct(array $disabledMethods = [], array $disabledFormats = [])
 {
     $methodsClasses = [Method\Command\Ar::getClass(), Method\Command\Bzip2::getClass(), Method\Command\Cabextract::getClass(), Method\Command\Cpio::getClass(), Method\Command\GnuGzip::getClass(), Method\Command\GnuTar::getClass(), Method\Command\Unrar::getClass(), Method\Command\Unshar::getClass(), Method\Command\Unzip::getClass(), Method\Command\X7zip::getClass(), Method\Command\Xz::getClass(), Method\Command\Gnome\Gcab::getClass(), Method\Extension\Pear\ArchiveTar::getClass(), Method\Extension\Bzip2::getClass(), Method\Extension\Phar::getClass(), Method\Extension\PharData::getClass(), Method\Extension\Rar::getClass(), Method\Extension\Zip::getClass(), Method\Extension\Zlib::getClass(), Method\Native\TarExtractor::getClass(), Method\Native\GzipExtractor::getClass()];
     $formatsClasses = [Format\Simple\Ace::getClass(), Format\Simple\Ar::getClass(), Format\Simple\Arc::getClass(), Format\Simple\Arj::getClass(), Format\Simple\Bin::getClass(), Format\Simple\Bz2::getClass(), Format\Simple\Cab::getClass(), Format\Simple\Chm::getClass(), Format\Simple\Cpio::getClass(), Format\Simple\Deb::getClass(), Format\Simple\Dmg::getClass(), Format\Simple\Epub::getClass(), Format\Simple\Exe::getClass(), Format\Simple\Gz::getClass(), Format\Simple\Hfs::getClass(), Format\Simple\Img::getClass(), Format\Simple\Iso::getClass(), Format\Simple\Jar::getClass(), Format\Simple\Lzh::getClass(), Format\Simple\Lzma::getClass(), Format\Simple\Msi::getClass(), Format\Simple\Phar::getClass(), Format\Simple\Rar::getClass(), Format\Simple\Rpm::getClass(), Format\Simple\Shar::getClass(), Format\Simple\Tar::getClass(), Format\Simple\Wim::getClass(), Format\Simple\X7z::getClass(), Format\Simple\Xz::getClass(), Format\Simple\Zip::getClass(), Format\Composed\TarBz2::getClass(), Format\Composed\TarGz::getClass(), Format\Composed\TarXz::getClass()];
     $this->formats = [];
     foreach ($formatsClasses as $formatClass) {
         if (false === in_array($formatClass::getName(), $disabledFormats)) {
             $this->formats[] = $formatClass::getClass();
         }
     }
     $this->methods = [];
     foreach ($methodsClasses as $methodClass) {
         if (false === in_array($methodClass::getName(), $disabledMethods)) {
             $this->methods[] = $methodClass::getClass();
         }
     }
 }
Exemple #2
0
 public function testFormatNotSupportedAfterDisablingAllMethods()
 {
     $this->setExpectedException('Distill\\Exception\\IO\\Input\\FileFormatNotSupportedException');
     $target = $this->getTemporaryPath();
     $this->clearTemporaryPath();
     $this->distill->disableMethod(Cabextract::getName());
     $this->distill->disableMethod(Gcab::getName());
     $this->distill->disableMethod(X7zip::getName());
     $result = $this->distill->extract($this->filesPath . 'file_ok.cab', $target, new Format\Simple\Cab());
     $this->clearTemporaryPath();
 }