/** * @param $pathInArchive * @return $this * @throws \Thelia\Exception\FileNotFoundException * @throws \ErrorException * * This method deletes a file in the archive */ public function deleteFile($pathInArchive) { if (!$this->hasFile($pathInArchive)) { $this->throwFileNotFound($pathInArchive); } if (false === $this->tar->delete($pathInArchive)) { throw new \ErrorException($this->translator->trans("Unknown error while deleting the file %file", ["%file" => $pathInArchive])); } }
} catch (PharException $e) { print_exception($e); } $a->convertToExecutable(array()); $a->convertToData(array()); try { $b = new PharData(dirname(__FILE__) . '/whatever.tar'); } catch (PharException $e) { print_exception($e); } try { $c = new PharData(dirname(__FILE__) . '/whatever.zip'); } catch (PharException $e) { print_exception($e); } $b->delete(array()); try { $a->delete('oops'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } try { $b->delete('oops'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } echo $a->getPath() . "\n"; try { $a->setAlias('oops'); } catch (Exception $e) { echo $e->getMessage() . "\n";