PHP Class lithium\console\Request

See also: lithium\console\Dispatcher
Inheritance: extends lithium\core\Object
Exibir arquivo Open project: unionofrad/lithium Class Usage Examples

Public Properties

Property Type Description
$argv array The raw data passed from the command line
$input resource Input (STDIN).
$params array Parameters parsed from arguments.

Protected Properties

Property Type Description
$_autoConfig array Auto configuration
$_env array Enviroment variables.
$_locale string Holds the value of the current locale, set through the locale() method.

Public Methods

Method Description
__construct ( array $config = [] ) : void Constructor.
__destruct ( ) : void Destructor. Closes input.
__get ( string $name ) : mixed Allows request parameters to be accessed as object properties, i.e. $this->request->action instead of $this->request->params['action'].
__isset ( $name )
args ( integer $key ) : mixed Get the value of a command line argument at a given key
env ( string $key = null ) : mixed Get environment variables.
input ( ) : string Reads a line from input.
locale ( string $locale = null ) : Returns Sets or returns the current locale string. For more information, see "Globalization" in the manual.
shift ( integer $num = 1 ) : self Moves params up a level. Sets command to action, action to passed[0], and so on.

Protected Methods

Method Description
_init ( ) : void Initialize request object, pulling request data from superglobals.

Method Details

__construct() public method

Constructor.
public __construct ( array $config = [] ) : void
$config array Available configuration options are: - `'args'` _array_ - `'input'` _resource|null_
return void

__destruct() public method

Destructor. Closes input.
public __destruct ( ) : void
return void

__get() public method

Allows request parameters to be accessed as object properties, i.e. $this->request->action instead of $this->request->params['action'].
See also: lithium\action\Request::$params
public __get ( string $name ) : mixed
$name string The property name/parameter key to return.
return mixed Returns the value of `$params[$name]` if it is set, otherwise returns null.

__isset() public method

public __isset ( $name )

_init() protected method

Defines an artificial 'PLATFORM' environment variable as 'CLI' to allow checking for the SAPI in a normalized way. This is also for establishing consistency with this class' sister classes.
See also: lithium\action\Request::_init()
protected _init ( ) : void
return void

args() public method

Get the value of a command line argument at a given key
public args ( integer $key ) : mixed
$key integer
return mixed returns null if key does not exist or the value of the key in the args array

env() public method

Get environment variables.
public env ( string $key = null ) : mixed
$key string
return mixed Returns the environment key related to the `$key` argument. If `$key` is equal to null the result will be the entire environment array. If `$key` is set but not available, `null` will be returned.

input() public method

Reads a line from input.
public input ( ) : string
return string

locale() public method

Sets or returns the current locale string. For more information, see "Globalization" in the manual.
public locale ( string $locale = null ) : Returns
$locale string An optional locale string like `'en'`, `'en_US'` or `'de_DE'`. If specified, will overwrite the existing locale.
return Returns the currently set locale string.

shift() public method

Moves params up a level. Sets command to action, action to passed[0], and so on.
public shift ( integer $num = 1 ) : self
$num integer how many times to shift
return self

Property Details

$_autoConfig protected_oe property

Auto configuration
protected array $_autoConfig
return array

$_env protected_oe property

Enviroment variables.
protected array $_env
return array

$_locale protected_oe property

Holds the value of the current locale, set through the locale() method.
protected string $_locale
return string

$argv public_oe property

The raw data passed from the command line
public array $argv
return array

$input public_oe property

Input (STDIN).
public resource $input
return resource

$params public_oe property

Parameters parsed from arguments.
See also: lithium\console\Router
public array $params
return array