Webmozart\Console\Api\Config\ApplicationConfig::hasCommandConfig PHP Method

hasCommandConfig() public method

Returns whether the application has a command with a given name.
See also: beginCommand()
public hasCommandConfig ( string $name ) : boolean
$name string The name of the command.
return boolean Returns `true` if the command configuration with the given name exists and `false` otherwise.
    public function hasCommandConfig($name)
    {
        foreach ($this->commandConfigs as $commandConfig) {
            if ($name === $commandConfig->getName()) {
                return true;
            }
        }
        return false;
    }

Usage Example

Ejemplo n.º 1
0
 public function testHasCommandConfig()
 {
     $this->config->addCommandConfig($config = new CommandConfig());
     $this->assertFalse($this->config->hasCommandConfig('command'));
     $this->assertFalse($this->config->hasCommandConfig('foobar'));
     $config->setName('command');
     $this->assertTrue($this->config->hasCommandConfig('command'));
     $this->assertFalse($this->config->hasCommandConfig('foobar'));
 }