vendor/api-platform/core/src/Api/IriConverterInterface.php line 44

  1. <?php
  2. /*
  3.  * This file is part of the API Platform project.
  4.  *
  5.  * (c) Kévin Dunglas <dunglas@gmail.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace ApiPlatform\Api;
  12. use ApiPlatform\Metadata\Exception\InvalidArgumentException;
  13. use ApiPlatform\Metadata\Exception\ItemNotFoundException;
  14. use ApiPlatform\Metadata\Exception\RuntimeException;
  15. use ApiPlatform\Metadata\Operation;
  16. /**
  17.  * Converts item and resources to IRI and vice versa.
  18.  *
  19.  * @author Kévin Dunglas <dunglas@gmail.com>
  20.  */
  21. interface IriConverterInterface
  22. {
  23.     /**
  24.      * Retrieves an item from its IRI.
  25.      *
  26.      * @throws InvalidArgumentException
  27.      * @throws ItemNotFoundException
  28.      */
  29.     public function getResourceFromIri(string $iri, array $context = [], Operation $operation null): object;
  30.     /**
  31.      * Gets the IRI associated with the given item.
  32.      *
  33.      * @param object|class-string $resource
  34.      *
  35.      * @throws InvalidArgumentException
  36.      * @throws RuntimeException
  37.      */
  38.     public function getIriFromResource(object|string $resourceint $referenceType UrlGeneratorInterface::ABS_PATHOperation $operation null, array $context = []): ?string;
  39. }