Webmozart\Console\Api\Config\CommandConfig::getSubCommandConfig PHP Method

getSubCommandConfig() public method

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

Usage Example

示例#1
0
 /**
  * @expectedException \Webmozart\Console\Api\Command\NoSuchCommandException
  */
 public function testGetSubCommandConfigFailsIfCommandNotFound()
 {
     $this->config->getSubCommandConfig('command');
 }