StaticRouteResolver implements MiddlewareInterface

Resolves static routes - can return configured content directly or load content from file / urls

Table of Contents

Interfaces

MiddlewareInterface

Properties

$linkService  : LinkService
$requestFactory  : RequestFactory

Methods

__construct()  : mixed
process()  : ResponseInterface
Checks if there is a valid site with route configuration.
getApplicableStaticRoute()  : array<string|int, mixed>|null
Find the proper configuration for the static route in the static route configuration. Mainly: - needs to have a valid "route" property - needs to have a "type"
getFromFile()  : array<string|int, mixed>
getFromUri()  : array<string|int, mixed>
getPageUri()  : string
resolveByType()  : array<string|int, mixed>

Properties

Methods

process()

Checks if there is a valid site with route configuration.

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface

getApplicableStaticRoute()

Find the proper configuration for the static route in the static route configuration. Mainly: - needs to have a valid "route" property - needs to have a "type"

protected getApplicableStaticRoute(array<string|int, mixed> $staticRouteConfiguration, Site $site, string $uriPath) : array<string|int, mixed>|null
Parameters
$staticRouteConfiguration : array<string|int, mixed>

the "routes" part of the site configuration

$site : Site

the current site where the configuration is based on

$uriPath : string

the path of the current request - used to match the "route" value of a single static route

Return values
array<string|int, mixed>|null

the configuration for the static route that matches, or null if no route is given

getFromFile()

protected getFromFile(File $file) : array<string|int, mixed>
Parameters
$file : File
Return values
array<string|int, mixed>

getFromUri()

protected getFromUri(string $uri) : array<string|int, mixed>
Parameters
$uri : string
Return values
array<string|int, mixed>

getPageUri()

protected getPageUri(ServerRequestInterface $request, Site $site, array<string|int, mixed> $urlParams) : string
Parameters
$request : ServerRequestInterface
$site : Site
$urlParams : array<string|int, mixed>
Return values
string

resolveByType()

protected resolveByType(ServerRequestInterface $request, Site $site, string $type, array<string|int, mixed> $routeConfig) : array<string|int, mixed>
Parameters
$request : ServerRequestInterface
$site : Site
$type : string
$routeConfig : array<string|int, mixed>
Tags
throws
InvalidRouteArgumentsException
Return values
array<string|int, mixed>

        
On this page

Search results