Webmozart\Console\Api\Config\SubCommandConfig::setParentConfig PHP Method

setParentConfig() public method

Sets the parent command configuration.
public setParentConfig ( CommandConfig $parentConfig )
$parentConfig CommandConfig The parent command configuration.
    public function setParentConfig(CommandConfig $parentConfig)
    {
        $this->parentConfig = $parentConfig;
        if ($parentConfig->getApplicationConfig()) {
            $this->setApplicationConfig($parentConfig->getApplicationConfig());
        }
    }

Usage Example

示例#1
0
 /**
  * Adds configuration for a sub-command.
  *
  * @param SubCommandConfig $config The sub-command configuration.
  *
  * @return static The current instance.
  *
  * @see beginSubCommand()
  */
 public function addSubCommandConfig(SubCommandConfig $config)
 {
     // The name is dynamic, so don't store by name
     $this->subCommandConfigs[] = $config;
     $config->setParentConfig($this);
     return $this;
 }