PHP Класс lithium\console\Request

См. также: lithium\console\Dispatcher
Наследование: extends lithium\core\Object
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$argv array The raw data passed from the command line
$input resource Input (STDIN).
$params array Parameters parsed from arguments.

Защищенные свойства (Protected)

Свойство Тип Описание
$_autoConfig array Auto configuration
$_env array Enviroment variables.
$_locale string Holds the value of the current locale, set through the locale() method.

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
_init ( ) : void Initialize request object, pulling request data from superglobals.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( array $config = [] ) : void
$config array Available configuration options are: - `'args'` _array_ - `'input'` _resource|null_
Результат void

__destruct() публичный Метод

Destructor. Closes input.
public __destruct ( ) : void
Результат void

__get() публичный Метод

Allows request parameters to be accessed as object properties, i.e. $this->request->action instead of $this->request->params['action'].
См. также: lithium\action\Request::$params
public __get ( string $name ) : mixed
$name string The property name/parameter key to return.
Результат mixed Returns the value of `$params[$name]` if it is set, otherwise returns null.

__isset() публичный Метод

public __isset ( $name )

_init() защищенный Метод

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.
См. также: lithium\action\Request::_init()
protected _init ( ) : void
Результат void

args() публичный Метод

Get the value of a command line argument at a given key
public args ( integer $key ) : mixed
$key integer
Результат mixed returns null if key does not exist or the value of the key in the args array

env() публичный Метод

Get environment variables.
public env ( string $key = null ) : mixed
$key string
Результат 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() публичный Метод

Reads a line from input.
public input ( ) : string
Результат string

locale() публичный Метод

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.
Результат Returns the currently set locale string.

shift() публичный Метод

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
Результат self

Описание свойств

$_autoConfig защищенное свойство

Auto configuration
protected array $_autoConfig
Результат array

$_env защищенное свойство

Enviroment variables.
protected array $_env
Результат array

$_locale защищенное свойство

Holds the value of the current locale, set through the locale() method.
protected string $_locale
Результат string

$argv публичное свойство

The raw data passed from the command line
public array $argv
Результат array

$input публичное свойство

Input (STDIN).
public resource $input
Результат resource

$params публичное свойство

Parameters parsed from arguments.
См. также: lithium\console\Router
public array $params
Результат array