ZipEntryNotFoundException.php 808 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace PhpZip\Exception;
  3. use PhpZip\Model\ZipEntry;
  4. /**
  5. * Thrown if entry not found.
  6. *
  7. * @author Ne-Lexa alexey@nelexa.ru
  8. * @license MIT
  9. */
  10. class ZipEntryNotFoundException extends ZipException
  11. {
  12. /** @var string */
  13. private $entryName;
  14. /**
  15. * ZipEntryNotFoundException constructor.
  16. *
  17. * @param ZipEntry|string $entryName
  18. */
  19. public function __construct($entryName)
  20. {
  21. $entryName = $entryName instanceof ZipEntry ? $entryName->getName() : $entryName;
  22. parent::__construct(sprintf(
  23. 'Zip Entry "%s" was not found in the archive.',
  24. $entryName
  25. ));
  26. $this->entryName = $entryName;
  27. }
  28. /**
  29. * @return string
  30. */
  31. public function getEntryName()
  32. {
  33. return $this->entryName;
  34. }
  35. }