tar = new ArchiveTar($file_path); } /** * {@inheritdoc} */ public function add($file_path) { $this->tar->add($file_path); return $this; } /** * {@inheritdoc} */ public function remove($file_path) { // @todo Archive_Tar doesn't have a remove operation // so we'll have to simulate it somehow, probably by // creating a new archive with everything but the removed // file. return $this; } /** * {@inheritdoc} */ public function extract($path, array $files = []) { if ($files) { $this->tar->extractList($files, $path); } else { $this->tar->extract($path); } return $this; } /** * {@inheritdoc} */ public function listContents() { $files = []; foreach ($this->tar->listContent() as $file_data) { $files[] = $file_data['filename']; } return $files; } /** * Retrieves the tar engine itself. * * In some cases it may be necessary to directly access the underlying * Archive_Tar object for implementation-specific logic. This is for advanced * use only as it is not shared by other implementations of ArchiveInterface. * * @return Archive_Tar * The Archive_Tar object used by this object. */ public function getArchive() { return $this->tar; } }