\Quark\RouterRouter

Router class.

Summary

Methods
Properties
Constants
__construct()
matchCurrentRequest()
match()
parseParameters()
setBasePath()
parseConfig()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$routes
$basePath
$currentRoute
N/A

Properties

$routes

$routes : array

Type

array — Routes.

$basePath

$basePath : string

Type

string — Base path.

$currentRoute

$currentRoute : \Quark\Router\Route

Type

\Quark\Router\Route — Current route.

Methods

__construct()

__construct(\Quark\Router\RouteCollection  $collection) 

Creates an instance of Router.

Parameters

\Quark\Router\RouteCollection $collection

Route collection.

matchCurrentRequest()

matchCurrentRequest() : \Quark\Router\Route|null

Match current request.

Returns

\Quark\Router\Route|null —

Matched route.

match()

match(string  $requestUrl, string  $requestMethod = \Fig\Http\Message\RequestMethodInterface::METHOD_GET) : \Quark\Router\Route|null

Match a request URL/methods.

Parameters

string $requestUrl

Request URL.

string $requestMethod

Request method.

Returns

\Quark\Router\Route|null —

Matched route.

parseParameters()

parseParameters(array  $keys, array  $values) : array

Parse parameters.

Parameters

array $keys

Parameters keys.

array $values

Values.

Returns

array —

Parameters.

setBasePath()

setBasePath(string  $basePath) 

Set base path.

Parameters

string $basePath

Base path.

parseConfig()

parseConfig(array  $config = array()) : \Quark\Router\Router

Parse configuration.

Parameters

array $config

Configuration.

Returns

\Quark\Router\Router