RelationshipsInterface.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php declare(strict_types=1);
  2. namespace Grav\Framework\Contracts\Relationships;
  3. use ArrayAccess;
  4. use Countable;
  5. use Iterator;
  6. use JsonSerializable;
  7. /**
  8. * Interface RelationshipsInterface
  9. *
  10. * @template T of \Grav\Framework\Contracts\Object\IdentifierInterface
  11. * @template P of \Grav\Framework\Contracts\Object\IdentifierInterface
  12. * @extends ArrayAccess<string,RelationshipInterface<T,P>>
  13. * @extends Iterator<string,RelationshipInterface<T,P>>
  14. */
  15. interface RelationshipsInterface extends Countable, ArrayAccess, Iterator, JsonSerializable
  16. {
  17. /**
  18. * @return bool
  19. * @phpstan-pure
  20. */
  21. public function isModified(): bool;
  22. /**
  23. * @return array
  24. */
  25. public function getModified(): array;
  26. /**
  27. * @return int
  28. * @phpstan-pure
  29. */
  30. public function count(): int;
  31. /**
  32. * @param string $offset
  33. * @return RelationshipInterface<T,P>|null
  34. */
  35. public function offsetGet($offset): ?RelationshipInterface;
  36. /**
  37. * @return RelationshipInterface<T,P>|null
  38. */
  39. public function current(): ?RelationshipInterface;
  40. /**
  41. * @return string
  42. * @phpstan-pure
  43. */
  44. public function key(): string;
  45. }