optionExists() 공개 정적인 메소드

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.
리턴 static The created exception.
예제 #1
0
 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);
             }
         }
     }
 }