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

addSubCommandConfigs() public method

Adds sub-command configurations to the command.
See also: beginSubCommand()
public addSubCommandConfigs ( array $configs ) : static
$configs array The sub-command configurations.
return static The current instance.
    public function addSubCommandConfigs(array $configs)
    {
        foreach ($configs as $command) {
            $this->addSubCommandConfig($command);
        }
        return $this;
    }

Usage Example

示例#1
0
 public function testAddSubCommandConfigs()
 {
     $this->config->addSubCommandConfig($config1 = new SubCommandConfig('command1'));
     $this->config->addSubCommandConfigs(array($config2 = new SubCommandConfig('command2'), $config3 = new SubCommandConfig('command3')));
     $this->assertSame(array($config1, $config2, $config3), $this->config->getSubCommandConfigs());
 }