Webmozart\Console\Api\Command\Command::getShortName PHP Method

getShortName() public method

This method only returns a value if an {@link OptionCommandConfig} was passed to the constructor. Otherwise this method returns null.
public getShortName ( ) : string | null
return string | null The short name or `null` if the command is not an option command.
    public function getShortName()
    {
        return $this->shortName;
    }

Usage Example

コード例 #1
0
 /**
  * Adds a command to the collection.
  *
  * If a command exists with the same name in the collection, that command
  * is overwritten.
  *
  * @param Command $command The command to add.
  *
  * @see merge(), replace()
  */
 public function add(Command $command)
 {
     $name = $command->getName();
     $this->commands[$name] = $command;
     if ($shortName = $command->getShortName()) {
         $this->shortNameIndex[$shortName] = $name;
     }
     foreach ($command->getAliases() as $alias) {
         $this->aliasIndex[$alias] = $name;
     }
     ksort($this->aliasIndex);
 }