resource = \RarArchive::open( $file, $password ); if ($this->resource === FALSE) throw new \Exception("Failed opening rar file {$file}"); return true; } /** * @param $destination - путь куда положить распакованные файлы * если указан аттрибут $file_name_prefix то происходит переименование файла * в результате выполнения метода заполняется аттрибут $extracted_files извлеченными файлами * если извлечение не произошло аттрибут $extracted_files - пустой */ public function extractTo( $destination){ $list = $this->resource->getEntries(); foreach($list as $entry) { $new_destination = $destination . '/' . $this->file_name_prefix .$entry->getName(); $entry->extract( $destination, $new_destination ); $this->setExtractedFiles( $new_destination, pathinfo( $entry->getName(), PATHINFO_EXTENSION ) ); } $this->resource->close(); } public static function getExtension(){ return 'rar'; } }