lithium\console\Command::__invoke()
Called by the Dispatcher
class to invoke an action.
Parameters
-
string
$action
The name of the method to run.
-
array
$args
The arguments from the request.
Returns
objectThe response object associated with this command.
Source
public function __invoke($action, $args = []) {
try {
$this->response->status = 1;
$result = call_user_func_array(array($this, $action), $args);
if (is_int($result)) {
$this->response->status = $result;
} elseif ($result || $result === null) {
$this->response->status = 0;
}
} catch (Exception $e) {
$this->error($e->getMessage());
}
return $this->response;
}