[Console] Added Command::isEnabled method that defines whether to add the command or not
This commit is contained in:
parent
dccd2d560f
commit
536d9790c3
@ -388,6 +388,11 @@ class Application
|
||||
{
|
||||
$command->setApplication($this);
|
||||
|
||||
if (!$command->isEnabled()) {
|
||||
$command->setApplication(null);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->commands[$command->getName()] = $command;
|
||||
|
||||
foreach ($command->getAliases() as $alias) {
|
||||
|
@ -116,6 +116,19 @@ class Command
|
||||
return $this->application;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the command is enabled or not in the current environment
|
||||
*
|
||||
* Override this to check for x or y and return false if the command can not
|
||||
* run properly under the current conditions.
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the current command.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user