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

getCommandConfig() public method

Returns the command configuration for a given name.
See also: beginCommand()
public getCommandConfig ( string $name ) : CommandConfig
$name string The name of the command.
return CommandConfig The command configuration.
    public function getCommandConfig($name)
    {
        foreach ($this->commandConfigs as $commandConfig) {
            if ($name === $commandConfig->getName()) {
                return $commandConfig;
            }
        }
        throw NoSuchCommandException::forCommandName($name);
    }

Usage Example

 /**
  * @expectedException \Webmozart\Console\Api\Command\NoSuchCommandException
  */
 public function testGetCommandConfigFailsIfCommandNotFound()
 {
     $this->config->getCommandConfig('command');
 }