IriParts final readonly class
Minn\Http\IriParts · public/minn/src/Minn/Http/IriParts.php · 138 lines
An IRI (a URL that may carry non-ASCII text) split into its parts and written back normalized: scheme and host in lower case, a scheme's default port dropped, dot segments removed, and every character a URL may not hold percent-encoded. The IRI form keeps non-ASCII characters; the URI form encodes them too.
Constants and properties
| private | PORTS = array ( 'acap' => 674, 'dict' => 2628, 'file' => NULL, 'http' => 80, 'https' => 443, ) | |
| prop | readonly ?string $scheme | Promoted from the constructor. |
| prop | readonly ?string $userinfo | Promoted from the constructor. |
| prop | readonly ?string $host | Promoted from the constructor. |
| prop | readonly ?int $port | Promoted from the constructor. |
| prop | readonly string $path | Promoted from the constructor. |
| prop | readonly ?string $query | Promoted from the constructor. |
| prop | readonly ?string $fragment | Promoted from the constructor. |
Public
| new | __construct(?string $scheme, ?string $userinfo, ?string $host, ?int $port, string $path, ?string $query, ?string $fragment)# | |
| static | parse(string $iri): self# | The parts of an IRI (RFC 3986 appendix B). |
| method | valid(): bool# | Whether the parts make a well-formed IRI: a valid scheme when there is one, no "//" path without an authority. |
| method | resolve(self $ref): ?self# | The reference resolved against this base (RFC 3986 section 5.2), or null when the base has no scheme. |
| method | withHost(?string $host): self# | The same IRI with another host. |
| method | withPath(string $path): self# | The same IRI with another path. |
| method | toIri(): string# | The normalized IRI: non-ASCII characters stay as they are. |
| method | toUri(): string# | The normalized URI: non-ASCII characters percent-encoded too. |
Internals 4
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
Nothing matches.