public function add(ICommand $command, bool $overwrite = false)
    {
        if (!$overwrite && $this->has($command->getName())) {
            throw new InvalidArgumentException("A command with name \"{$command->getName()}\" already exists");
        }

        $command->setCommandCollection($this);
        $this->commands[$command->getName()] = $command;
    }
public function add(ICommand $command, bool $overwrite = false)
    {
        if (!$overwrite && $this->has($command->getName())) {
            throw new InvalidArgumentException("A command with name \"{$command->getName()}\" already exists");
        }

        $command->setCommandCollection($this);
        $this->commands[$command->getName()] = $command;
    }
public function add ( ICommand $ command , bool $ overwrite = false ) { if ( ! $ overwrite && $ this -> has ( $ command -> getName ( ) ) ) { throw new InvalidArgumentException ( "A command with name \"{$command->getName()}\" already exists" ) ; } $ command -> setCommandCollection ( $ this ) ; $ this -> commands [ $ command -> getName ( ) ] = $ command ; }
Adds a command

@param ICommand $command The command to add
@param bool $overwrite True if we will overwrite a command with the same name if it already exists
@throws InvalidArgumentException Thrown if a command with the input name already exists
Adds a command