\CodeIgniter\CLICommandRunner

Command runner

Summary

Methods
Properties
Constants
initController()
_remap()
index()
getCommands()
No public properties found
No constants found
forceHTTPS()
cachePage()
loadHelpers()
validate()
runCommand()
createCommandList()
$helpers
$request
$response
$logger
$forceHTTPS
$validator
$commands
N/A
No private methods found
No private properties found
N/A

Properties

$helpers

$helpers : array

An array of helpers to be automatically loaded upon class instantiation.

Type

array

$forceHTTPS

$forceHTTPS : integer

Whether HTTPS access should be enforced for all methods in this controller.

Type

integer — Number of seconds to set HSTS header

$commands

$commands : array

Stores the info about found Commands.

Type

array

Methods

_remap()

_remap(string  $method, array  ...$params) : mixed

We map all un-routed CLI methods through this function so we have the chance to look for a Command first.

Parameters

string $method
array $params variadic

Throws

\ReflectionException

Returns

mixed

index()

index(array  $params) : mixed

Default command.

Parameters

array $params

Throws

\ReflectionException

Returns

mixed

getCommands()

getCommands() : array

Allows access to the current commands that have been found.

Returns

array

forceHTTPS()

forceHTTPS(integer  $duration = 31536000) 

A convenience method to use when you need to ensure that a single method is reached only via HTTPS. If it isn't, then a redirect will happen back to this method and HSTS header will be sent to have modern browsers transform requests automatically.

Parameters

integer $duration

The number of seconds this link should be considered secure for. Only with HSTS header. Default value is 1 year.

Throws

\CodeIgniter\HTTP\Exceptions\HTTPException

cachePage()

cachePage(integer  $time) 

Provides a simple way to tie into the main CodeIgniter class and tell it how long to cache the current page for.

Parameters

integer $time

loadHelpers()

loadHelpers() 

Handles "auto-loading" helper files.

validate()

validate(array|string  $rules, array  $messages = array()) : boolean

A shortcut to performing validation on input data. If validation is not successful, a $errors property will be set on this class.

Parameters

array|string $rules
array $messages

An array of custom error messages

Returns

boolean

runCommand()

runCommand(string  $command, array  $params) : mixed

Actually runs the command.

Parameters

string $command
array $params

Returns

mixed

createCommandList()

createCommandList() 

Scans all Commands directories and prepares a list of each command with it's group and file.

Throws

\ReflectionException