EndOfCentralDirectory.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of the nelexa/zip package.
  5. * (c) Ne-Lexa <https://github.com/Ne-Lexa/php-zip>
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. namespace PhpZip\Model;
  10. /**
  11. * End of Central Directory.
  12. */
  13. class EndOfCentralDirectory
  14. {
  15. /** @var int Count files. */
  16. private int $entryCount;
  17. /** @var int Central Directory Offset. */
  18. private int $cdOffset;
  19. private int $cdSize;
  20. /** @var string|null The archive comment. */
  21. private ?string $comment;
  22. /** @var bool Zip64 extension */
  23. private bool $zip64;
  24. public function __construct(int $entryCount, int $cdOffset, int $cdSize, bool $zip64, ?string $comment = null)
  25. {
  26. $this->entryCount = $entryCount;
  27. $this->cdOffset = $cdOffset;
  28. $this->cdSize = $cdSize;
  29. $this->zip64 = $zip64;
  30. $this->comment = $comment;
  31. }
  32. public function setComment(?string $comment): void
  33. {
  34. $this->comment = $comment;
  35. }
  36. public function getEntryCount(): int
  37. {
  38. return $this->entryCount;
  39. }
  40. public function getCdOffset(): int
  41. {
  42. return $this->cdOffset;
  43. }
  44. public function getCdSize(): int
  45. {
  46. return $this->cdSize;
  47. }
  48. public function getComment(): ?string
  49. {
  50. return $this->comment;
  51. }
  52. public function isZip64(): bool
  53. {
  54. return $this->zip64;
  55. }
  56. }