Properties

$route

$route : string

Matched route

Type

string

$wildcards

$wildcards : array

Wildcard route

Type

array

$controller

$controller : string

Controller class string name or closure function

Type

string

$action

$action : string

Action name for the controller class

Type

string

$controllerParams

$controllerParams : array

Matched controller parameters

Type

array

$dispatchParams

$dispatchParams : array

Matched dispatch parameters

Type

array

$defaultController

$defaultController : mixed

Default controller class string name or closure function

Type

mixed

$routes

$routes : array

Prepared routes

Type

array

$arguments

$arguments : array

Array of arguments

Type

array

$argumentString

$argumentString : string

Argument string

Type

string

Methods

hasRoute()

hasRoute() : boolean

Determine if the route has been matched

Returns

boolean

getRoute()

getRoute() : string

Get the matched route

Returns

string

getRoutes()

getRoutes() : array

Get the prepared routes

Returns

array

getController()

getController() : string

Get the matched controller class name or closure function

Returns

string

getAction()

getAction() : string

Get the matched action name

Returns

string

getControllerParams()

getControllerParams() : array

Get the matched controller params

Returns

array

hasControllerParams()

hasControllerParams() : boolean

Determine if there are matched controller params

Returns

boolean

getDispatchParams()

getDispatchParams() : array

Get the matched dispatch params

Returns

array

hasDispatchParams()

hasDispatchParams() : boolean

Determine if there are matched dispatch params

Returns

boolean

getDefaultController()

getDefaultController() : mixed

Get the default controller class name or closure function

Returns

mixed

__construct()

__construct() : \Pop\Router\Match\Cli

Constructor

Instantiate the CLI match object

Returns

\Pop\Router\Match\Cli

match()

match(array  $routes) : boolean

Match the route to the controller class. Possible matches are:

foo - Route command with 1 required param foo [] - Route command with 1 required param and 1 optional param foo [bar|baz] - Route command with 1 required alternate sub-command foo -o1 [-o2] - Route command with 1 required short option and 1 optional short option foo --option1|-o1 [--option2|-o2] - Route command with 1 required option and 1 optional option (both long and short) foo --name= [--email=] - Route command with 1 required value param and 1 optional value param

- OR -

foo*   - Turns off strict matching and allows any route that starts with 'foo' to pass

Parameters

array $routes

Returns

boolean

noRouteFound()

noRouteFound(boolean  $exit = true) : void

Method to process if a route was not found

Parameters

boolean $exit

setArguments()

setArguments() : \Pop\Router\Match\Cli

Set the route arguments

Returns

\Pop\Router\Match\Cli

getArguments()

getArguments() : array

Get the route arguments

Returns

array

getArgumentString()

getArgumentString() : string

Get the route argument string

Returns

string

prepareRoutes()

prepareRoutes(array  $routes) : void

Prepare the routes

Parameters

array $routes

getDispatchParamsFromRoute()

getDispatchParamsFromRoute(string  $route) : array

Get parameters from the route string

Parameters

string $route

Returns

array

processDispatchParamsFromRoute()

processDispatchParamsFromRoute(array  $params, array  $dispatchParams) : mixed

Process parameters from the route string

Parameters

array $params
array $dispatchParams

Returns

mixed

processMatchedParams()

processMatchedParams(array  $matchedParams, array  $controller) : mixed

Process matched parameters

Parameters

array $matchedParams
array $controller

Returns

mixed

isOptional()

isOptional(string  $route) : boolean

Determine if the route segment is optional

Parameters

string $route

Returns

boolean

isCommand()

isCommand(string  $route) : boolean

Determine if the route segment is a command

Parameters

string $route

Returns

boolean

isOption()

isOption(string  $route) : boolean

Determine if the route segment is an option

Parameters

string $route

Returns

boolean

isValue()

isValue(string  $route) : boolean

Determine if the route segment is a value

Parameters

string $route

Returns

boolean

isOptionValue()

isOptionValue(string  $route) : boolean

Determine if the route segment is option value

Parameters

string $route

Returns

boolean

hasAlternate()

hasAlternate(string  $value) : boolean

Determine if the route segment has an alternate

Parameters

string $value

Returns

boolean