[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  
   4  namespace Fig\Link;
   5  
   6  use Psr\Link\EvolvableLinkInterface;
   7  
   8  /**
   9   * Class EvolvableLinkTrait
  10   *
  11   * @implements EvolvableLinkInterface
  12   */
  13  trait EvolvableLinkTrait
  14  {
  15      use LinkTrait;
  16  
  17      /**
  18       * {@inheritdoc}
  19       *
  20       * @return EvolvableLinkInterface
  21       */
  22      public function withHref($href)
  23      {
  24          /** @var EvolvableLinkInterface $that */
  25          $that = clone($this);
  26          $that->href = $href;
  27  
  28          $that->templated = ($this->hrefIsTemplated($href));
  29  
  30          return $that;
  31      }
  32  
  33      /**
  34       * {@inheritdoc}
  35       *
  36       * @return EvolvableLinkInterface
  37       */
  38      public function withRel($rel)
  39      {
  40          /** @var EvolvableLinkInterface $that */
  41          $that = clone($this);
  42          $that->rel[$rel] = true;
  43          return $that;
  44      }
  45  
  46      /**
  47       * {@inheritdoc}
  48       *
  49       * @return EvolvableLinkInterface
  50       */
  51      public function withoutRel($rel)
  52      {
  53          /** @var EvolvableLinkInterface $that */
  54          $that = clone($this);
  55          unset($that->rel[$rel]);
  56          return $that;
  57      }
  58  
  59      /**
  60       * {@inheritdoc}
  61       *
  62       * @return EvolvableLinkInterface
  63       */
  64      public function withAttribute($attribute, $value)
  65      {
  66          /** @var EvolvableLinkInterface $that */
  67          $that = clone($this);
  68          $that->attributes[$attribute] = $value;
  69          return $that;
  70      }
  71  
  72      /**
  73       * {@inheritdoc}
  74       *
  75       * @return EvolvableLinkInterface
  76       */
  77      public function withoutAttribute($attribute)
  78      {
  79          /** @var EvolvableLinkInterface $that */
  80          $that = clone($this);
  81          unset($that->attributes[$attribute]);
  82          return $that;
  83      }
  84  }


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