vendor/presta/sitemap-bundle/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 <www.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 requirements for sitemap protocol
  13. *
  14. * @see http://www.sitemaps.org/protocol.html
  15. *
  16. * @author depely
  17. */
  18. abstract class XmlConstraint implements \Countable
  19. {
  20. const LIMIT_ITEMS = 49999;
  21. const LIMIT_BYTES = 50000000; // 52,428,800 bytes - 2,428,800
  22. /**
  23. * @var bool
  24. */
  25. protected $limitItemsReached = false;
  26. /**
  27. * @var bool
  28. */
  29. protected $limitBytesReached = false;
  30. /**
  31. * @var int
  32. */
  33. protected $countBytes = 0;
  34. /**
  35. * @var int
  36. */
  37. protected $countItems = 0;
  38. /**
  39. * @return bool
  40. */
  41. public function isFull()
  42. {
  43. return $this->limitItemsReached || $this->limitBytesReached;
  44. }
  45. /**
  46. * @inheritdoc
  47. */
  48. public function count()
  49. {
  50. return $this->countItems;
  51. }
  52. /**
  53. * Render full and valid xml
  54. */
  55. abstract public function toXml();
  56. }