[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/fig/link-util/src/ -> EvolvableLinkProviderTrait.php (source)

   1  <?php
   2  
   3  namespace Fig\Link;
   4  
   5  use Psr\Link\LinkInterface;
   6  use Psr\Link\EvolvableLinkProviderInterface;
   7  
   8  /**
   9   * Class EvolvableLinkProviderTrait
  10   *
  11   * @implements EvolvableLinkProviderInterface
  12   */
  13  trait EvolvableLinkProviderTrait
  14  {
  15      use LinkProviderTrait;
  16  
  17      /**
  18       * {@inheritdoc}
  19       */
  20      public function withLink(LinkInterface $link)
  21      {
  22          $that = clone($this);
  23          $splosh = spl_object_hash($link);
  24          if (!array_key_exists($splosh, $that->links)) {
  25              $that->links[$splosh] = $link;
  26          }
  27          return $that;
  28      }
  29  
  30      /**
  31       * {@inheritdoc}
  32       */
  33      public function withoutLink(LinkInterface $link)
  34      {
  35          $that = clone($this);
  36          $splosh = spl_object_hash($link);
  37          unset($that->links[$splosh]);
  38          return $that;
  39      }
  40  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer