\app\framework\Component\Route\KleinRouteFactory

RouteFactory

The default implementation of the AbstractRouteFactory

Summary

Methods
Properties
Constants
__construct()
getNamespace()
setNamespace()
appendNamespace()
build()
No public properties found
NULL_PATH_VALUE
pathIsNull()
shouldPathStringCauseRouteMatch()
preprocessPathString()
$namespace
N/A
No private methods found
No private properties found
N/A

Constants

NULL_PATH_VALUE

NULL_PATH_VALUE

The value given to path's when they are entered as null values

Properties

$namespace

$namespace : 

The namespace of which to collect the routes in when matching, so you can define routes under a common endpoint

Type

Methods

__construct()

__construct(string  $namespace = null) 

Constructor

Parameters

string $namespace

The initial namespace to set

getNamespace()

getNamespace() : string

Gets the value of namespace

Returns

string

appendNamespace()

appendNamespace(string  $namespace) : \app\framework\Component\Route\Klein\AbstractRouteFactory

Append a namespace to the current namespace

Parameters

string $namespace

The namespace from which to collect the Routes under

Returns

\app\framework\Component\Route\Klein\AbstractRouteFactory

build()

build(callable  $callback, string  $path = null, string|array  $method = null, boolean  $count_match = true, string  $name = null) : \app\framework\Component\Route\Klein\Route

Build a Route instance

This method should be implemented to return a Route instance

Parameters

callable $callback

Callable callback method to execute on route match

string $path

Route URI path to match

string|array $method

HTTP Method to match

boolean $count_match

Whether or not to count the route as a match when counting total matches

string $name

The name of the route

Returns

\app\framework\Component\Route\Klein\Route

pathIsNull()

pathIsNull(mixed  $path) : boolean

Check if the path is null or equal to our match-all, null-like value

Parameters

mixed $path

Returns

boolean

shouldPathStringCauseRouteMatch()

shouldPathStringCauseRouteMatch(string  $path) : boolean

Quick check to see whether or not to count the route as a match when counting total matches

Parameters

string $path

Returns

boolean

preprocessPathString()

preprocessPathString(string  $path) : string

Pre-process a path string

This method wraps the path string in a regular expression syntax baesd on whether the string is a catch-all or custom regular expression. It also adds the namespace in a specific part, based on the style of expression

Parameters

string $path

Returns

string