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);
    }
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);
    }
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 ) ; }
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()
Adds a command to the collection .