Creates an exception for the code {@link OPTION_EXISTS}.
public static optionExists ( string $name, Exception $cause = null ) : static | ||
$name | string | The command name. |
$cause | Exception | The exception that caused this exception. |
return | static | The created exception. |
private function validateSubCommandName(SubCommandConfig $config) { $name = $config->getName(); if (!$name) { throw CannotAddCommandException::nameEmpty(); } if ($this->subCommands->contains($name)) { throw CannotAddCommandException::nameExists($name); } if ($config instanceof OptionCommandConfig) { if ($this->argsFormat->hasOption($name)) { throw CannotAddCommandException::optionExists($name); } if ($shortName = $config->getShortName()) { if ($this->subCommands->contains($shortName)) { throw CannotAddCommandException::nameExists($name); } if ($this->argsFormat->hasOption($shortName)) { throw CannotAddCommandException::optionExists($shortName); } } } }