ElementList.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace Sabre\VObject;
  3. use ArrayIterator;
  4. use LogicException;
  5. /**
  6. * VObject ElementList.
  7. *
  8. * This class represents a list of elements. Lists are the result of queries,
  9. * such as doing $vcalendar->vevent where there's multiple VEVENT objects.
  10. *
  11. * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
  12. * @author Evert Pot (http://evertpot.com/)
  13. * @license http://sabre.io/license/ Modified BSD License
  14. */
  15. class ElementList extends ArrayIterator
  16. {
  17. /* {{{ ArrayAccess Interface */
  18. /**
  19. * Sets an item through ArrayAccess.
  20. *
  21. * @param int $offset
  22. * @param mixed $value
  23. *
  24. * @return void
  25. */
  26. #[\ReturnTypeWillChange]
  27. public function offsetSet($offset, $value)
  28. {
  29. throw new LogicException('You can not add new objects to an ElementList');
  30. }
  31. /**
  32. * Sets an item through ArrayAccess.
  33. *
  34. * This method just forwards the request to the inner iterator
  35. *
  36. * @param int $offset
  37. *
  38. * @return void
  39. */
  40. #[\ReturnTypeWillChange]
  41. public function offsetUnset($offset)
  42. {
  43. throw new LogicException('You can not remove objects from an ElementList');
  44. }
  45. /* }}} */
  46. }