ToOneRelationshipInterface.php 962 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php declare(strict_types=1);
  2. namespace Grav\Framework\Contracts\Relationships;
  3. use Grav\Framework\Contracts\Object\IdentifierInterface;
  4. /**
  5. * Interface ToOneRelationshipInterface
  6. *
  7. * @template T of IdentifierInterface
  8. * @template P of IdentifierInterface
  9. * @template-extends RelationshipInterface<T,P>
  10. */
  11. interface ToOneRelationshipInterface extends RelationshipInterface
  12. {
  13. /**
  14. * @param string|null $id
  15. * @param string|null $type
  16. * @return T|null
  17. * @phpstan-pure
  18. */
  19. public function getIdentifier(string $id = null, string $type = null): ?IdentifierInterface;
  20. /**
  21. * @param string|null $id
  22. * @param string|null $type
  23. * @return T|null
  24. * @phpstan-pure
  25. */
  26. public function getObject(string $id = null, string $type = null): ?object;
  27. /**
  28. * @param T|null $identifier
  29. * @return bool
  30. */
  31. public function replaceIdentifier(IdentifierInterface $identifier = null): bool;
  32. }