ImmutableZipContainer.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace PhpZip\Model;
  3. /**
  4. * Class ImmutableZipContainer.
  5. */
  6. class ImmutableZipContainer implements \Countable
  7. {
  8. /** @var ZipEntry[] */
  9. protected $entries;
  10. /** @var string|null Archive comment */
  11. protected $archiveComment;
  12. /**
  13. * ZipContainer constructor.
  14. *
  15. * @param ZipEntry[] $entries
  16. * @param string|null $archiveComment
  17. */
  18. public function __construct(array $entries, $archiveComment)
  19. {
  20. $this->entries = $entries;
  21. $this->archiveComment = $archiveComment;
  22. }
  23. /**
  24. * @return ZipEntry[]
  25. */
  26. public function &getEntries()
  27. {
  28. return $this->entries;
  29. }
  30. /**
  31. * @return string|null
  32. */
  33. public function getArchiveComment()
  34. {
  35. return $this->archiveComment;
  36. }
  37. /**
  38. * Count elements of an object.
  39. *
  40. * @see https://php.net/manual/en/countable.count.php
  41. *
  42. * @return int The custom count as an integer.
  43. * The return value is cast to an integer.
  44. */
  45. public function count()
  46. {
  47. return \count($this->entries);
  48. }
  49. }