final class ApiRoutePathResolver (View source)

Applies the shared normalization rules used for API prefixes, routes and request matching.

Methods

string
normalizePrefix(string $prefix)

Converts a root prefix to an empty prefix and removes surrounding or trailing slashes otherwise.

string
string
normalizePath(string $path)

Produces an absolute normalized path while preserving the root path.

string
string
compose(string $prefix, string $path)

Joins an API prefix and endpoint-relative path using canonical slash rules.

string
string|null
resolveRequestPath(string $prefix, string $requestPath)

Removes the matching API prefix, returning null when the request lies outside that boundary.

string|null

Details

normalizePrefix

string normalizePrefix(string $prefix)

Converts a root prefix to an empty prefix and removes surrounding or trailing slashes otherwise.

Parameters

string $prefix

Return Value

string

normalizePath

string normalizePath(string $path)

Produces an absolute normalized path while preserving the root path.

Parameters

string $path

Return Value

string

compose

string compose(string $prefix, string $path)

Joins an API prefix and endpoint-relative path using canonical slash rules.

Parameters

string $prefix
string $path

Return Value

string

resolveRequestPath

string|null resolveRequestPath(string $prefix, string $requestPath)

Removes the matching API prefix, returning null when the request lies outside that boundary.

Parameters

string $prefix
string $requestPath

Return Value

string|null