isEnabled() public method

Override this to check for x or y and return false if the command can not run properly under the current conditions.
public isEnabled ( ) : boolean
return boolean
 /**
  * {@inheritdoc}
  */
 public function isEnabled()
 {
     if (null === $this->profiler) {
         return false;
     }
     return parent::isEnabled();
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function isEnabled()
 {
     if (version_compare(phpversion(), '5.4.0', '<')) {
         return false;
     }
     return parent::isEnabled();
 }
 /**
  * {@inheritdoc}
  */
 public function isEnabled()
 {
     if (!class_exists('Symfony\\Component\\Process\\Process')) {
         return false;
     }
     return parent::isEnabled();
 }
 /**
  * Adds a command object.
  *
  * If a command with the same name already exists, it will be overridden.
  *
  * @param Command $command A Command object
  *
  * @return Command The registered command
  *
  * @api
  */
 public function add(Command $command)
 {
     $command->setApplication($this);
     if (!$command->isEnabled()) {
         $command->setApplication(null);
         return;
     }
     if (null === $command->getDefinition()) {
         throw new \LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
     }
     $this->commands[$command->getName()] = $command;
     foreach ($command->getAliases() as $alias) {
         $this->commands[$alias] = $command;
     }
     return $command;
 }
Example #5
0
 /**
  * Adds a command object.
  *
  * If a command with the same name already exists, it will be overridden.
  *
  * @param Command $command A Command object
  *
  * @return Command The registered command
  *
  * @api
  */
 public function add(Command $command)
 {
     $command->setApplication($this);
     if (!$command->isEnabled()) {
         $command->setApplication(null);
         return;
     }
     $this->commands[$command->getName()] = $command;
     foreach ($command->getAliases() as $alias) {
         $this->commands[$alias] = $command;
     }
     return $command;
 }
 /**
  * {@inheritdoc}
  */
 public function isEnabled()
 {
     return $this->decoratedCommand->isEnabled();
 }
Example #7
0
 public function isEnabled()
 {
     return $this->innerCommand->isEnabled();
 }
 /**
  * {@inheritdoc}
  */
 public function isEnabled()
 {
     $enabled = parent::isEnabled();
     // Hide the command in the list, if necessary.
     if ($enabled && $this->hiddenInList) {
         global $argv;
         $enabled = !isset($argv[1]) || $argv[1] != 'list';
     }
     return $enabled;
 }
Example #9
0
 /**
  * {@inheritdoc}
  */
 public function isEnabled()
 {
     return class_exists(BaseLintCommand::class) && parent::isEnabled();
 }