vendor/api-platform/core/src/Metadata/IriConverterInterface.php line 45

  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\Metadata;
  12. use ApiPlatform\Metadata\Exception\InvalidArgumentException;
  13. use ApiPlatform\Metadata\Exception\ItemNotFoundException;
  14. use ApiPlatform\Metadata\Exception\RuntimeException;
  15. if (interface_exists(\ApiPlatform\Api\IriConverterInterface::class)) {
  16.     class_alias(
  17.         \ApiPlatform\Api\IriConverterInterface::class,
  18.         __NAMESPACE__.'\IriConverterInterface'
  19.     );
  20.     if (false) { // @phpstan-ignore-line
  21.         interface IriConverterInterface extends \ApiPlatform\Api\IriConverterInterface
  22.         {
  23.         }
  24.     }
  25. } else {
  26.     /**
  27.      * Converts item and resources to IRI and vice versa.
  28.      *
  29.      * @author Kévin Dunglas <dunglas@gmail.com>
  30.      */
  31.     interface IriConverterInterface
  32.     {
  33.         /**
  34.          * Retrieves an item from its IRI.
  35.          *
  36.          * @throws InvalidArgumentException
  37.          * @throws ItemNotFoundException
  38.          */
  39.         public function getResourceFromIri(string $iri, array $context = [], Operation $operation null): object;
  40.         /**
  41.          * Gets the IRI associated with the given item.
  42.          *
  43.          * @param object|class-string $resource
  44.          *
  45.          * @throws InvalidArgumentException
  46.          * @throws RuntimeException
  47.          */
  48.         public function getIriFromResource(object|string $resourceint $referenceType UrlGeneratorInterface::ABS_PATHOperation $operation null, array $context = []): ?string;
  49.     }
  50. }