class RouteDefinitionProvider (View source)

Provides route definitions and matching arrays for the router.

Properties

protected int[][] $staticRoutes
protected int[][] $segmentCounts
protected int[][][] $segmentValues
protected array[] $routeDefinitions
protected int[] $routesByName

Methods

void
addRouteDefinition(RouteDefinition $definition)

Adds a new route definition.

string
getCacheFile()

Returns PHP code for cached RouteDefinitionProvider that can be stored in file and included.

array
getRoutesByStaticPath(string $path)

Returns route ids for routes with specific static path.

array
getRoutesBySegmentCount(int $count)

Returns route ids with specific segment count.

array
getRoutesBySegmentValue(int $segment, string $value)

Returns route ids with specific value for specific segment.

getRouteDefinition(int $routeId)

Returns a route definition by a specific id.

getRouteDefinitionByName(string $name)

Returns a route definition by the name of the route.

Details

void addRouteDefinition(RouteDefinition $definition)

Adds a new route definition.

Parameters

RouteDefinition $definition A new route definition to add

Return Value

void

string getCacheFile()

Returns PHP code for cached RouteDefinitionProvider that can be stored in file and included.

Return Value

string PHP code for cached RouteDefinitionProvider

array getRoutesByStaticPath(string $path)

Returns route ids for routes with specific static path.

Parameters

string $path The static route path to search

Return Value

array List of route ids with specific static path

array getRoutesBySegmentCount(int $count)

Returns route ids with specific segment count.

Parameters

int $count The number of segments in the path

Return Value

array List of route ids with specific segment count

array getRoutesBySegmentValue(int $segment, string $value)

Returns route ids with specific value for specific segment.

Parameters

int $segment The number of the segment
string $value The value for the segment or '/' dynamic segments

Return Value

array List of route ids the match the given criteria

RouteDefinition getRouteDefinition(int $routeId)

Returns a route definition by a specific id.

Parameters

int $routeId Id of the route definition

Return Value

RouteDefinition The route definition for the specific id

RouteDefinition getRouteDefinitionByName(string $name)

Returns a route definition by the name of the route.

Parameters

string $name The name of the route

Return Value

RouteDefinition The route definition with the given name