/** * Constructor. */ public function __construct(array $disabledMethods = [], array $disabledFormats = []) { $methodsClasses = [Method\Command\Bzip2::getClass(), Method\Command\Cabextract::getClass(), Method\Command\GnuGzip::getClass(), Method\Command\GnuTar::getClass(), Method\Command\Unrar::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\Phar::getClass(), Method\Extension\PharData::getClass(), Method\Extension\Rar::getClass(), Method\Extension\Zip::getClass(), Method\Native\TarExtractor::getClass()]; $formatsClasses = [Format\Bz2::getClass(), Format\Cab::getClass(), Format\Epub::getClass(), Format\Gz::getClass(), Format\Phar::getClass(), Format\Rar::getClass(), Format\Tar::getClass(), Format\TarBz2::getClass(), Format\TarGz::getClass(), Format\TarXz::getClass(), Format\x7z::getClass(), Format\Xz::getClass(), Format\Zip::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(); } } }
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\Cab()); $this->clearTemporaryPath(); }
/** * {@inheritdoc} */ public static function getUncompressionMethods() { return [Method\Command\GnuTar::getName(), Method\Command\x7zip::getName(), Method\Extension\PharData::getName(), Method\Extension\Pear\ArchiveTar::getName()]; }
/** * {@inheritdoc} */ public static function getUncompressionMethods() { return [Method\Command\Unzip::getName(), Method\Command\x7zip::getName(), Method\Extension\Zip::getName()]; }