lithium\console\Command::_init()
Overrides
lithium\core\ObjectDeprecated::_init()
Command Initializer.
Populates the $response
property with a new instance of the Response
class passing it
configuration and assigns the values from named parameters of the request (if applicable) to
properties of the command.
Returns
voidSource
protected function _init() {
parent::_init();
$this->request = $this->_config['request'];
if (!is_object($this->request) || !$this->request->params) {
return;
}
$default = ['command' => null, 'action' => null, 'args' => null];
$params = array_diff_key((array) $this->request->params, $default);
foreach ($params as $key => $param) {
$this->{$key} = $param;
}
$this->response = $this->_config['response'];
if (!is_object($this->response)) {
$this->response = Libraries::instance(
null,
'response',
$this->response + ['plain' => $this->plain],
$this->_classes
);
}
}