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

setSubCommandConfigs() public method

Sets the sub-command configurations of the command.
See also: beginSubCommand()
public setSubCommandConfigs ( array $configs ) : static
$configs array The sub-command configurations.
return static The current instance.
    public function setSubCommandConfigs(array $configs)
    {
        $this->subCommandConfigs = array();
        $this->addSubCommandConfigs($configs);
        return $this;
    }

Usage Example

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