UrlDetails final class
Minn\Rest\UrlDetails · public/minn/src/Minn/Rest/UrlDetails.php · 64 lines
A page's details as the editor's link previews read them (probe rest-embed-details), from the document's head: everything up to its closer, the whole page when it has none. The first title, as text with its tags gone; the first link whose rel names "icon" (not an apple-touch-icon); the first meta named description; the first meta whose property is og:image or og:image:url. Twitter tags, og:title and og:description count for nothing. Each is trimmed. An address with no host hangs off the page's root whatever its own path, and one with no scheme takes the page's.
Public
| static | of(string $html, string $url): array# | The page's four details, read from its markup; addresses made whole against the page's own. @return array{title: string, icon: string, description: string, image: string} @return array{title: string, icon: string, description: string, image: string} |
Internals 3
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | read(Minn\Html\Tags $tags): array# | Which detail the tag holds, and its value. @return array{0: ?string, 1: string} @return array{0: ?string, 1: string} |
| private | text(?string $value): string# | Text as a preview shows it: tags gone, trimmed. |
| private | absolute(string $value, string $url): string# | An address made whole against the page's root. |
Nothing matches.