vendor/presta/sitemap-bundle/src/Sitemap/XmlConstraint.php line 57

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the PrestaSitemapBundle package.
  4. *
  5. * (c) PrestaConcept <https://prestaconcept.net>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Presta\SitemapBundle\Sitemap;
  11. /**
  12. * Xml constraints for sitemap protocol
  13. *
  14. * https://www.sitemaps.org/protocol.html
  15. */
  16. abstract class XmlConstraint implements \Countable
  17. {
  18. public const LIMIT_ITEMS = 49999;
  19. public const LIMIT_BYTES = 50000000; // 52,428,800 bytes - 2,428,800
  20. /**
  21. * @var bool
  22. */
  23. protected $limitItemsReached = false;
  24. /**
  25. * @var bool
  26. */
  27. protected $limitBytesReached = false;
  28. /**
  29. * @var int
  30. */
  31. protected $countBytes = 0;
  32. /**
  33. * @var int
  34. */
  35. protected $countItems = 0;
  36. /**
  37. * @return bool
  38. */
  39. public function isFull(): bool
  40. {
  41. return $this->limitItemsReached || $this->limitBytesReached;
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function count(): int
  47. {
  48. return $this->countItems;
  49. }
  50. /**
  51. * Render full and valid xml
  52. */
  53. abstract public function toXml(): string;
  54. }