CoreFiles by mySites.guru
LinkProviderTrait.php41 lines, 784 bytes, from Joomla_5.4.11-Stable-Full_Package.zip
Raw History Compare with 5.4.10
md5
9ebeea4607c4fbb45a6804871c1d4fd1
sha1
be8a643fb68c0cc419ecea4e2b42178a13d0bac9
sha256
181168d75406d14be9732249dce9f0a005931fdacaeb35ae1b5b8f31e860841e
<?php


namespace Fig\Link;

use Psr\Link\LinkProviderInterface;
use Psr\Link\LinkInterface;

/**
 * Class LinkProviderTrait
 *
 * @implements LinkProviderInterface
 */
trait LinkProviderTrait
{
    /**
     * An array of the links in this provider.
     *
     * The keys of the array MUST be the spl_object_hash() of the object being stored.
     * That helps to ensure uniqueness.
     *
     * @var LinkInterface[]
     */
    private array $links = [];

    /**
     * {@inheritdoc}
     */
    public function getLinks(): iterable
    {
        return $this->links;
    }

    /**
     * {@inheritdoc}
     */
    public function getLinksByRel($rel): iterable
    {
        return array_filter($this->links, fn(LinkInterface $link) => in_array($rel, $link->getRels()));
    }
}

The same content is in 157 releases, Joomla 5.0.0-alpha1 to 6.2.1. See them all, or every version of this file.