vendor/pimcore/pimcore/models/DataObject/Data/ImageGallery.php line 80

Open in your IDE?
  1. <?php
  2. /**
  3. * Pimcore
  4. *
  5. * This source file is available under two different licenses:
  6. * - GNU General Public License version 3 (GPLv3)
  7. * - Pimcore Commercial License (PCL)
  8. * Full copyright and license information is available in
  9. * LICENSE.md which is distributed with this source code.
  10. *
  11. * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12. * @license http://www.pimcore.org/license GPLv3 and PCL
  13. */
  14. namespace Pimcore\Model\DataObject\Data;
  15. use Pimcore\Model\DataObject\OwnerAwareFieldInterface;
  16. use Pimcore\Model\DataObject\Traits\OwnerAwareFieldTrait;
  17. class ImageGallery implements \Iterator, OwnerAwareFieldInterface
  18. {
  19. use OwnerAwareFieldTrait;
  20. /**
  21. * @var Hotspotimage[]
  22. */
  23. protected $items;
  24. /**
  25. * @param Hotspotimage[] $items
  26. */
  27. public function __construct($items)
  28. {
  29. $this->setItems($items);
  30. $this->markMeDirty();
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function current()
  36. {
  37. $var = current($this->items);
  38. return $var;
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function next()
  44. {
  45. next($this->items);
  46. }
  47. /**
  48. * {@inheritdoc}
  49. */
  50. public function key()
  51. {
  52. $var = key($this->items);
  53. return $var;
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. public function valid()
  59. {
  60. $var = $this->current() !== false;
  61. return $var;
  62. }
  63. /**
  64. * {@inheritdoc}
  65. */
  66. public function rewind()
  67. {
  68. reset($this->items);
  69. }
  70. /**
  71. * @return Hotspotimage[]
  72. */
  73. public function getItems()
  74. {
  75. return $this->items;
  76. }
  77. /**
  78. * @param Hotspotimage[] $items
  79. */
  80. public function setItems($items)
  81. {
  82. if (!is_array($items)) {
  83. $items = [];
  84. }
  85. $this->items = $items;
  86. $this->rewind();
  87. $this->markMeDirty();
  88. }
  89. }