Add a command to the commands list.

@param CommandInterface|string $command Either an object or full path to the command class.

@throws TelegramSDKException

@return CommandBus
517125
public function addCommand($command)
    {
        $command = $this->resolveCommandObject($command);

        /*
         * At this stage we definitely have a proper command to use.
         *
         * @var Command $command
         */
        $this->commands[$command->getName()] = $command;

        $aliases = $command->getAliases();

        if (empty($aliases)) {
            return $this;
        }

        foreach ($command->getAliases() as $alias) {
            if (isset($this->commands[$alias])) {
                throw new TelegramSDKException(sprintf(
                    '[Error] Alias [%s] conflicts with command name of "%s" try with another name or remove this alias from the list.',
                    $alias,
                    get_class($command)
                ));
            }

            if (isset($this->commandAliases[$alias])) {
                throw new TelegramSDKException(sprintf(
                    '[Error] Alias [%s] conflicts with another command\'s alias list: "%s", try with another name or remove this alias from the list.',
                    $alias,
                    get_class($command)
                ));
            }

            $this->commandAliases[$alias] = $command;
        }

        return $this;


    }
606272
private function wrapCommandWithMessageEnvelope($command)
    {
        if ($command instanceof Command) {
            return $command;
        }

        if ($command instanceof Serializable) {
            return new GenericCommand(MessageIdentifier::generate(), $command);
        }

        throw new \InvalidArgumentException('Unsupported data type.');
    }
1130097
public function addCommand($command)
    {
        if (is_string($command)) {
            $command = $this->app->make($command);
        }

        if ($command instanceof Command) {
            $command->setLaravel($this->app);
        }

        $this->console->add($command);
    }
936920
public function add(Command $command)
    {
        $command->setApplication($this);

        if (!$command->isEnabled()) {
            $command->setApplication(null);

            return;
        }

        if (null === $command->getDefinition()) {
            throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command)));
        }

        $this->commands[$command->getName()] = $command;

        foreach ($command->getAliases() as $alias) {
            $this->commands[$alias] = $command;
        }

        return $command;
    }
860155
public function addCommands(array $commands, CommandInterface $before = null)
    {
        foreach ($commands as $command) {
            $this->addCommand($command, $before);
        }

        return $this;
    }
670357
public function setCommandConfiguration($command, array $properties)
    {
        $url = "selendroid/configure/command/{$command}";
        $properties['command'] = $command;
        $this->driver->curl($this->driver->factoryCommand($url, WebDriver_Command::METHOD_POST, $properties));
        return $this;
    }
1299012
public function add(SymfonyCommand $command)
    {
        if ($command instanceof Command) {
            $command->setCygnite($this->cygnite);
        }

        return $this->addCommandToParent($command);
    }
784089
public function command($command)
    {
        if (!in_array($command, ['start', 'stop', 'restart', 'reload', 'force-reload', 'status'])) {
            throw new \InvalidArgumentException($command);
        }

        $command = 'sudo /etc/init.d/tor '.$command;
        $command = new Command($command);
        $command->execute();

        return $command;
    }
1262293
public function execute($command)
    {
        $validator = $this->translator->toValidator($command);

        if (class_exists($validator)) {
            $this->app->make($validator)->validate($command);
        }

        return $this->bus->execute($command);
    }
1200018
public function addCommands(array $commands)
    {
        foreach ($commands as $name => $command) {
            $this->addCommand($command, is_numeric($name) ? null : $name);
        }
        return $this;
    }
1293239
public function setCommand($command)
    {
        if (!preg_match(self::$_regex['command'], $command)) {
            throw new \InvalidArgumentException(sprintf('Command "%s" is incorect', $command));
        }

        $this->command = $command;

        return $this->generateHash();
    }
530453
public function add(SymfonyCommand $command)
    	{
    		if ($command instanceof Command) {
    			$command->setThin($this->thin);
    		}

    		return $this->addToParent($command);
    	}
641031
public function Rcon( $Command )
		{
			if( !$this->Connected )
			{
				throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
			}
			
			if( $this->Rcon === null )
			{
				throw new SocketException( 'You must set a RCON password before trying to execute a RCON command.', SocketException::NOT_CONNECTED );
			}
			
			return $this->Rcon->Command( $Command );
		}
209732
public function setCommand($command)
    {
        if (!is_string($command)) {
            throw new InvalidArgumentException('string', 0);
        }
        // escape command
        $this->command = ($this->flags & ESCAPE) ? escapeshellcmd($command) : $command;

        return $this;
    }
811219
public function registerCommand($command, $callable, array $options = [])
    {
        if (array_key_exists($command, $this->commands)) {
            throw new \Exception("A command with the name {$command} already exists.");
        }

        list($commandInstance, $options) = $this->buildCommand($command, $callable, $options);
        $this->commands[$command]        = $commandInstance;

        foreach ($options['aliases'] as $alias) {
            $this->addCommandAlias($alias, $command);
        }

        return $commandInstance;
    }
1330399
public function handle($command)
    {
        $message = $this->message->send($command->conversation, $command->body, $command->senderId, $command->type);

        $this->dispatcher->dispatch($this->message->releaseEvents());

        return $message;
    }
1128473
protected function registerMakeRequestCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\RequestMakeCommand($app);
        });
    }