CoreFiles by mySites.guru
LinkProviderTrait.php44 lines, 832 bytes, from Joomla_4.0.0-beta1-Beta-Full_Package.zip
Raw History Compare with 3.9.0-beta4
md5
623c57896a74b2e22768f0e233dd1cd2
sha1
6b44aee7c1c98f0acdaa23ec74482ab47002e679
sha256
7dbadad63cc0385621746e9dc5b408b706eada4e8b230c730c119471d0e73b43
<?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 $links = [];

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

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

The same content is in 141 releases, Joomla 4.0.0-alpha2 to 4.4.14. See them all, or every version of this file.