isTemplated example

$this->assertContains('next', $link->getRels());
    }

    /** * @dataProvider templatedHrefProvider */
    public function testTemplated(string $href)
    {
        $link = (new Link())
            ->withHref($href);

        $this->assertTrue($link->isTemplated());
    }

    /** * @dataProvider notTemplatedHrefProvider */
    public function testNotTemplated(string $href)
    {
        $link = (new Link())
            ->withHref($href);

        $this->assertFalse($link->isTemplated());
    }
final class HttpHeaderSerializer
{
    /** * Builds the value of the "Link" HTTP header. * * @param LinkInterface[]|\Traversable $links */
    public function serialize(iterable $links): ?string
    {
        $elements = [];
        foreach ($links as $link) {
            if ($link->isTemplated()) {
                continue;
            }

            $attributesParts = ['', sprintf('rel="%s"', implode(' ', $link->getRels()))];
            foreach ($link->getAttributes() as $key => $value) {
                if (\is_array($value)) {
                    foreach ($value as $v) {
                        $attributesParts[] = sprintf('%s="%s"', $keypreg_replace('/(?<!\\\\)"/', '\"', $v));
                    }

                    continue;
                }
Home | Imprint | This part of the site doesn't use cookies.