Added an execute() method to context to catch unhandled commands
This commit is contained in:
@ -146,6 +146,23 @@ class Context
|
||||
return array_key_exists('global', $info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Catch-all handler for commands not defined in context, globally or builtin.
|
||||
* Override this function and return true if the command is handled ok.
|
||||
*
|
||||
* @param string $command The command to execute
|
||||
* @param string[] $args The arguments to the command
|
||||
* @return bool True if the command was handled
|
||||
*/
|
||||
public function execute($command, ...$args)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the context
|
||||
*
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
|
Reference in New Issue
Block a user