API / Minn\Front / ResourceHints

ResourceHints final class

Minn\Front\ResourceHints · public/minn/src/Minn/Front/ResourceHints.php · 56 lines

The resource hint links wp_head prints (wp_resource_hints): each relation (dns-prefetch, preconnect, prefetch, prerender) handed to the filter with what the engine found, its entries printed once each. A plain address prints rel first; an entry given as attributes prints its href, the attributes the reference keeps (as, crossorigin, pr, type; a bare word for a numeric key) and rel last. dns-prefetch names only the host, preconnect the scheme and host, the others the whole address (probe media-template-doubts).

Constants and properties

privateKEPT = array ( 0 => 'as', 1 => 'crossorigin', 2 => 'href', 3 => 'pr', 4 => 'type', )

Public

staticrender(array $dnsPrefetch, Closure $filter): string#

The links, one a line.

$dnsPrefetchlist<string>the external hosts the queued assets use
$filterClosure(array, string): mixedthe wp_resource_hints filter

Internals 2

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateaddress(string $href, string $relation): string#

An entry's address as its relation names it.

privatewithAttributes(string $href, array $attrs, string $relation): string#
$attrsarray<int|string, mixed>