API / Minn\Rest / Links

Links final class

Minn\Rest\Links · public/minn/src/Minn/Rest/Links.php · 83 lines

Response link relations compacted through CURIEs: a rel that matches a CURIE's template becomes `name:suffix`, and the used CURIEs ride along.

Used by 1

Public

staticitem(string $rel, string $href, array $attributes): array#

One link as a response serves it: its attributes, then its href; a self link's target hints after the href, where the reference adds them.

$attributesarray<string, mixed>
@return array<string, mixed>
staticexpanded(array $links): array#

An answer's compact links as the reference keeps them on a response: each link under its full relation (a curie's short name expanded, the curies themselves dropped), with its href and its other attributes.

$linksarray<string, mixed>
@return list<array{0: string, 1: string, 2: array<string, mixed>}>
staticcompact(array $links, array $curies): array#

Links with their curies applied, as the reference compacts them.

$linksarray<string, mixed>rel => items
$curieslist<array{name: string, href: string, templated?: bool}>
@return array<string, mixed>