PHP Class lithium\console\Request

See also: lithium\console\Dispatcher
Inheritance: extends lithium\core\Object
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Méthodes publiques

Свойство Type Description
$argv array The raw data passed from the command line
$input resource Input (STDIN).
$params array Parameters parsed from arguments.

Protected Properties

Свойство Type Description
$_autoConfig array Auto configuration
$_env array Enviroment variables.
$_locale string Holds the value of the current locale, set through the locale() method.

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode Description
_init ( ) : void Initialize request object, pulling request data from superglobals.

Method Details

__construct() public méthode

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

__destruct() public méthode

Destructor. Closes input.
public __destruct ( ) : void
Résultat void

__get() public méthode

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.
Résultat mixed Returns the value of `$params[$name]` if it is set, otherwise returns null.

__isset() public méthode

public __isset ( $name )

_init() protected méthode

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
Résultat void

args() public méthode

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

env() public méthode

Get environment variables.
public env ( string $key = null ) : mixed
$key string
Résultat 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 méthode

Reads a line from input.
public input ( ) : string
Résultat string

locale() public méthode

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.
Résultat Returns the currently set locale string.

shift() public méthode

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
Résultat self

Property Details

$_autoConfig protected_oe property

Auto configuration
protected array $_autoConfig
Résultat array

$_env protected_oe property

Enviroment variables.
protected array $_env
Résultat array

$_locale protected_oe property

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

$argv public_oe property

The raw data passed from the command line
public array $argv
Résultat array

$input public_oe property

Input (STDIN).
public resource $input
Résultat resource

$params public_oe property

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