ZipNewStringEntry.php 786 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace PhpZip\Model\Entry;
  3. use PhpZip\Exception\ZipException;
  4. /**
  5. * New zip entry from string.
  6. *
  7. * @see https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT .ZIP File Format Specification
  8. * @author Ne-Lexa alexey@nelexa.ru
  9. * @license MIT
  10. */
  11. class ZipNewStringEntry extends ZipNewEntry
  12. {
  13. /**
  14. * @var string
  15. */
  16. private $entryContent;
  17. /**
  18. * ZipNewStringEntry constructor.
  19. * @param string $entryContent
  20. */
  21. public function __construct($entryContent)
  22. {
  23. $this->entryContent = $entryContent;
  24. }
  25. /**
  26. * Returns an string content of the given entry.
  27. *
  28. * @return null|string
  29. * @throws ZipException
  30. */
  31. public function getEntryContent()
  32. {
  33. return $this->entryContent;
  34. }
  35. }