Properties

$ident

$ident : string

Route identifier/name

Type

string

$route

$route : string

Route pattern

Type

string

$methods

$methods : array<mixed,string>

HTTP methods supported by this route

Type

array<mixed,string>

$controller

$controller : string

Response controller classname

Should be the class-ident of an action, a script or a template controller.

Type

string

$groups

$groups : array<mixed,string>

Parent route groups

Type

array<mixed,string>

$template

$template : string

The template ident (to load).

Type

string

$engine

$engine : string

The view engine ident to use.

Ex: "mustache", ""

Type

string

$templateData

$templateData : array

Additional template data.

Type

array

$redirect

$redirect : string

Redirect URL.

Type

string

$redirectMode

$redirectMode : integer

Redirect Mode (HTTP status code).

Type

integer

$cache

$cache : boolean

Enable route-level caching for this template.

Type

boolean

$cache_ttl

$cache_ttl : integer

If using cache, the time-to-live, in seconds, of the cache. (0 = no limit).

Type

integer

Methods

setIdent()

setIdent(string  $ident) : \Charcoal\App\Route\RouteConfig

Set route identifier

Parameters

string $ident

Route identifier.

Throws

\InvalidArgumentException

If the identifier is not a string.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

ident()

ident() : string

Get route identifier

Returns

string

setRoute()

setRoute(string  $pattern) : \Charcoal\App\Route\RouteConfig

Set route pattern.

Parameters

string $pattern

Route pattern.

Throws

\InvalidArgumentException

If the pattern argument is not a string.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

route()

route() : string

Get route pattern

Returns

string

setGroups()

setGroups(array<mixed,string>|array<mixed,\Charcoal\App\Route\RouteGroup>  $groups) : \Charcoal\App\Route\RouteConfig

Set parent route groups

Parameters

array<mixed,string>|array<mixed,\Charcoal\App\Route\RouteGroup> $groups

The parent route groups.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

addGroup()

addGroup(string|\Charcoal\App\Route\RouteGroup  $group) : \Charcoal\App\Route\RouteConfig

Add parent route group

Parameters

string|\Charcoal\App\Route\RouteGroup $group

The parent route group.

Throws

\InvalidArgumentException

If the group is invalid.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

groups()

groups() : array

Get parent route groups

Returns

array

setController()

setController(string  $controller) : \Charcoal\App\Route\RouteConfig

Set route view controller classname

Parameters

string $controller

Route controller name.

Throws

\InvalidArgumentException

If the route view controller is not a string.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

controller()

controller() : string

Get the view controller classname

If not set, the self::ident() will be used by default.

Returns

string

setMethods()

setMethods(array<mixed,string>  $methods) : \Charcoal\App\Route\RouteConfig

Set route methods

Parameters

array<mixed,string> $methods

The route's supported HTTP methods.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

addMethod()

addMethod(string  $method) : \Charcoal\App\Route\RouteConfig

Add route HTTP method.

Parameters

string $method

The route's supported HTTP method.

Throws

\InvalidArgumentException

If the HTTP method is invalid.

Returns

\Charcoal\App\Route\RouteConfig

Chainable

methods()

methods() : array<mixed,string>

Get route methods

Returns

array<mixed,string>

setTemplate()

setTemplate(string|null  $template) : \Charcoal\App\Route\TemplateRouteConfig

Parameters

string|null $template

The template identifier.

Throws

\InvalidArgumentException

If the tempalte parameter is not null or not a string.

Returns

\Charcoal\App\Route\TemplateRouteConfig

Chainable

template()

template() : string

Returns

string

defaultController()

defaultController() : string

Returns

string

setEngine()

setEngine(string|null  $engine) : \Charcoal\App\Route\TemplateRouteConfig

Parameters

string|null $engine

The engine identifier (mustache, php, or mustache-php).

Throws

\InvalidArgumentException

If the engine is not null or not a string.

Returns

\Charcoal\App\Route\TemplateRouteConfig

Chainable

engine()

engine() : string

Returns

string

defaultEngine()

defaultEngine() : string

Returns

string

setTemplateData()

setTemplateData(array  $templateData) : \Charcoal\App\Route\TemplateRouteConfig

Set the template data for the view.

Parameters

array $templateData

The route template data.

Returns

\Charcoal\App\Route\TemplateRouteConfig

Chainable

templateData()

templateData() : array

Get the template data for the view.

Returns

array

setRedirect()

setRedirect(string|array<mixed,string>  $url) : \Charcoal\App\Route\TemplateRouteConfig

Parameters

string|array<mixed,string> $url

Points to a route.

Returns

\Charcoal\App\Route\TemplateRouteConfig

Chainable

redirect()

redirect() : string|array<mixed,string>

Retrieve the redirection URL.

Returns

string|array<mixed,string>

setRedirectMode()

setRedirectMode(mixed  $redirectMode) : \Charcoal\App\Route\TemplateRouteConfig

Set the redirect HTTP status mode. (Must be 3xx)

Parameters

mixed $redirectMode

The HTTP status code.

Throws

\InvalidArgumentException

If the redirect mode is not 3xx.

Returns

\Charcoal\App\Route\TemplateRouteConfig

Chainable

redirectMode()

redirectMode() : integer

Returns

integer

cache()

cache() : boolean

Returns

boolean

setCacheTtl()

setCacheTtl(integer  $ttl) : \Charcoal\App\Route\TemplateRouteConfig

Parameters

integer $ttl

The cache Time-To-Live, in seconds.

Returns

\Charcoal\App\Route\TemplateRouteConfig

Chainable

cacheTtl()

cacheTtl() : integer

Returns

integer