Documentation

Cli extends AbstractMatch
in package

Pop router CLI match class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.7.0

Table of Contents

$commands  : array<string|int, mixed>
Route commands
$controllerParams  : array<string|int, mixed>
Controller parameters
$defaultRoute  : array<string|int, mixed>
Default route
$dynamicRoute  : string
Dynamic route
$dynamicRoutePrefix  : array<string|int, mixed>
Dynamic route prefix
$hasAllRequired  : bool
Flag for all required parameters
$isDynamicRoute  : bool
Flag for dynamic route
$options  : array<string|int, mixed>
Allowed route options
$parameters  : array<string|int, mixed>
Allowed route parameters
$preparedRoutes  : array<string|int, mixed>
Prepared routes
$route  : string
Matched route
$routeNames  : array<string|int, mixed>
Route names
$routeParams  : array<string|int, mixed>
Route parameters
$routes  : array<string|int, mixed>
Routes
$routeString  : string
Route string
$segments  : array<string|int, mixed>
Segments of route string
__construct()  : mixed
Constructor
addControllerParams()  : AbstractMatch
Add controller params to be passed into a new controller instance
addRoute()  : AbstractMatch
Add a route
addRoutes()  : AbstractMatch
Add multiple controller routes
appendControllerParams()  : AbstractMatch
Append controller params to be passed into a new controller instance
getAction()  : mixed
Get the action
getCommandOptions()  : array<string|int, mixed>
Get the command options
getCommandParameters()  : array<string|int, mixed>
Get the command parameters
getCommands()  : array<string|int, mixed>
Get the route commands
getController()  : mixed
Get the controller
getControllerParams()  : mixed
Get the params assigned to the controller
getDefaultRoute()  : array<string|int, mixed>
Get the default route
getDynamicRoute()  : string
Get the dynamic route
getDynamicRoutePrefix()  : array<string|int, mixed>
Get the dynamic route prefix
getFlattenedRoutes()  : array<string|int, mixed>
Get flattened routes
getOption()  : mixed
Get a parsed route option
getOptions()  : array<string|int, mixed>
Get the parsed route options
getOriginalRoute()  : string
Get original route string
getParameter()  : mixed
Get a parsed route param
getParameters()  : array<string|int, mixed>
Get the parsed route params
getPreparedRoutes()  : array<string|int, mixed>
Get prepared routes
getRoute()  : string
Get route regex
getRouteConfig()  : mixed
Get route config
getRouteParams()  : array<string|int, mixed>
Get the params discovered from the route
getRoutes()  : array<string|int, mixed>
Get routes
getRouteString()  : string
Get the route string
getSegment()  : string
Get a route string segment
getSegments()  : array<string|int, mixed>
Get the route string segments
hasAction()  : bool
Determine if there is an action
hasController()  : bool
Determine if there is a controller
hasControllerParams()  : bool
Determine if the controller has params
hasDefaultRoute()  : bool
Determine if there is a default route
hasDynamicRoute()  : bool
Determine if there is a dynamic route
hasName()  : bool
Has a route name
hasRoute()  : bool
Determine if the route has been matched
hasRouteConfig()  : bool
Has route config
hasRouteParams()  : bool
Determine if the route has params
isDynamicRoute()  : bool
Determine if it is a dynamic route
match()  : bool
Match the route
name()  : AbstractMatch
Add a route name
noRouteFound()  : void
Method to process if a route was not found
prepare()  : Cli
Prepare the routes
removeControllerParams()  : AbstractMatch
Remove controller params
flattenRoutes()  : void
Flatten the nested routes
getRouteRegex()  : array<string|int, mixed>
Get the REGEX pattern for the route string
parseRouteParams()  : void
Parse route dispatch parameters

Properties

$commands

Route commands

protected array<string|int, mixed> $commands = []

$controllerParams

Controller parameters

protected array<string|int, mixed> $controllerParams = []

$defaultRoute

Default route

protected array<string|int, mixed> $defaultRoute = null

$dynamicRoute

Dynamic route

protected string $dynamicRoute = null

$dynamicRoutePrefix

Dynamic route prefix

protected array<string|int, mixed> $dynamicRoutePrefix = null

$hasAllRequired

Flag for all required parameters

protected bool $hasAllRequired = true

$isDynamicRoute

Flag for dynamic route

protected bool $isDynamicRoute = false

$options

Allowed route options

protected array<string|int, mixed> $options = [ 'options' => [], // [-v|--verbose] 'values' => [], // [-n|--name=] 'arrays' => [], ]

$parameters

Allowed route parameters

protected array<string|int, mixed> $parameters = []

$preparedRoutes

Prepared routes

protected array<string|int, mixed> $preparedRoutes = []

$routeNames

Route names

protected array<string|int, mixed> $routeNames = []

$routeParams

Route parameters

protected array<string|int, mixed> $routeParams = []

$routes

Routes

protected array<string|int, mixed> $routes = []

$routeString

Route string

protected string $routeString = null

$segments

Segments of route string

protected array<string|int, mixed> $segments = []

Methods

__construct()

Constructor

public __construct() : mixed

Instantiate the CLI match object

Return values
mixed

addControllerParams()

Add controller params to be passed into a new controller instance

public addControllerParams(string $controller, mixed $params) : AbstractMatch
Parameters
$controller : string
$params : mixed
Return values
AbstractMatch

appendControllerParams()

Append controller params to be passed into a new controller instance

public appendControllerParams(string $controller, mixed $params) : AbstractMatch
Parameters
$controller : string
$params : mixed
Return values
AbstractMatch

getAction()

Get the action

public getAction() : mixed
Return values
mixed

getCommandOptions()

Get the command options

public getCommandOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCommandParameters()

Get the command parameters

public getCommandParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCommands()

Get the route commands

public getCommands() : array<string|int, mixed>
Return values
array<string|int, mixed>

getController()

Get the controller

public getController() : mixed
Return values
mixed

getControllerParams()

Get the params assigned to the controller

public getControllerParams(string $controller) : mixed
Parameters
$controller : string
Return values
mixed

getDefaultRoute()

Get the default route

public getDefaultRoute() : array<string|int, mixed>
Return values
array<string|int, mixed>

getDynamicRoute()

Get the dynamic route

public getDynamicRoute() : string
Return values
string

getDynamicRoutePrefix()

Get the dynamic route prefix

public getDynamicRoutePrefix() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFlattenedRoutes()

Get flattened routes

public getFlattenedRoutes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getOption()

Get a parsed route option

public getOption(string $name) : mixed
Parameters
$name : string
Return values
mixed

getOptions()

Get the parsed route options

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getOriginalRoute()

Get original route string

public getOriginalRoute() : string
Return values
string

getParameter()

Get a parsed route param

public getParameter(string $name) : mixed
Parameters
$name : string
Return values
mixed

getParameters()

Get the parsed route params

public getParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPreparedRoutes()

Get prepared routes

public getPreparedRoutes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRoute()

Get route regex

public getRoute() : string
Return values
string

getRouteConfig()

Get route config

public getRouteConfig([string $key = null ]) : mixed
Parameters
$key : string = null
Return values
mixed

getRouteParams()

Get the params discovered from the route

public getRouteParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRoutes()

Get routes

public getRoutes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getRouteString()

Get the route string

public getRouteString() : string
Return values
string

getSegment()

Get a route string segment

public getSegment(int $i) : string
Parameters
$i : int
Return values
string

getSegments()

Get the route string segments

public getSegments() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasAction()

Determine if there is an action

public hasAction() : bool
Return values
bool

hasController()

Determine if there is a controller

public hasController() : bool
Return values
bool

hasControllerParams()

Determine if the controller has params

public hasControllerParams(string $controller) : bool
Parameters
$controller : string
Return values
bool

hasDefaultRoute()

Determine if there is a default route

public hasDefaultRoute() : bool
Return values
bool

hasDynamicRoute()

Determine if there is a dynamic route

public hasDynamicRoute() : bool
Return values
bool

hasName()

Has a route name

public hasName(string $routeName) : bool
Parameters
$routeName : string
Return values
bool

hasRoute()

Determine if the route has been matched

public hasRoute() : bool
Return values
bool

hasRouteConfig()

Has route config

public hasRouteConfig([string $key = null ]) : bool
Parameters
$key : string = null
Return values
bool

hasRouteParams()

Determine if the route has params

public hasRouteParams() : bool
Return values
bool

isDynamicRoute()

Determine if it is a dynamic route

public isDynamicRoute() : bool
Return values
bool

match()

Match the route

public match([string $forceRoute = null ]) : bool
Parameters
$forceRoute : string = null
Return values
bool

noRouteFound()

Method to process if a route was not found

public noRouteFound([bool $exit = true ]) : void
Parameters
$exit : bool = true
Return values
void

prepare()

Prepare the routes

public prepare() : Cli
Return values
Cli

flattenRoutes()

Flatten the nested routes

protected flattenRoutes(array<string|int, mixed>|string $route[, mixed $controller = null ]) : void
Parameters
$route : array<string|int, mixed>|string
$controller : mixed = null
Return values
void

getRouteRegex()

Get the REGEX pattern for the route string

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

parseRouteParams()

Parse route dispatch parameters

protected parseRouteParams() : void
Return values
void

Search results