API / Minn\Feed / Iri

Iri final class

Minn\Feed\Iri · public/minn/src/Minn/Feed/Iri.php · 109 lines

URLs in feeds: a reference resolved against its base (RFC 3986), then normalized the way the reference prints them: scheme and host in lower case, the default port dropped, dot segments removed, and every byte a URL may not carry (spaces, angle brackets, non-ASCII) percent-encoded.

Used by 2

Constants and properties

privateDEFAULT_PORTS = array ( 'http' => 80, 'https' => 443, 'ftp' => 21, )

Public

staticresolve(string $base, string $reference): ?string#

The reference resolved against the base and normalized; null when neither is absolute.

staticclean(string $url): string#

An absolute URL normalized; anything else returned as given.

Internals 5

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

privatesplit(string $url): array#
@return array{scheme: ?string, authority: ?string, path: string, query: ?string, fragment: ?string}
privatemerge(array $base, string $path): string#
privatenormalize(array $parts): string#
privateremoveDots(string $path): string#
privateencode(string $text, string $allowed): string#

Percent-encodes every byte outside the unreserved and sub-delimiter sets and the extra characters a component allows.