Registers a new command.

@param string           $command  The command name.
@param \Callable|string $callable The function called when the command is executed.
@param array            $options  An array of options.

@return Command The command instance.
11059
public function registerSubCommand($command, $callable, array $options = [])
    {
        if (array_key_exists($command, $this->subCommands)) {
            throw new \Exception("A sub-command with the name {$command} already exists.");
        }

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

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

        return $commandInstance;
    }
32726
public function call($command, array $parameters = array())
	{
		$parameters['command'] = $command;

		$this->lastOutput = new BufferedOutput;

		return $this->find($command)->run(new ArrayInput($parameters), $this->lastOutput);
	}
1215145
protected function registerAddonNameCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Addons\Commands\AddonNameCommand($app);
        });
    }
125996
protected function registerMakeListenerCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\ListenerMakeCommand($app);
        });
    }
790013
public function call(callable $callable, array $args = [])
    {
        if (is_string($callable) && strpos($callable, '::') !== false) {
            $callable = explode('::', $callable);
        }

        if (is_array($callable)) {
            if (is_string($callable[0])) {
                $callable[0] = $this->getContainer()->get($callable[0]);
            }

            $reflection = new ReflectionMethod($callable[0], $callable[1]);

            if ($reflection->isStatic()) {
                $callable[0] = null;
            }

            return $reflection->invokeArgs($callable[0], $this->reflectArguments($reflection, $args));
        }

        if (is_object($callable)) {
            $reflection = new ReflectionMethod($callable, '__invoke');

            return $reflection->invokeArgs($callable, $this->reflectArguments($reflection, $args));
        }

        $reflection = new ReflectionFunction($callable);

        return $reflection->invokeArgs($this->reflectArguments($reflection, $args));
    }
1275535
public function execute($command, callable $next)
    {
        try {
            return $next($command);
        } catch (ExceptionInterface $exception) {
            throw $exception;
        } catch (ValidationException $exception) {
            $this->exceptionHandler->throwServiceExceptionFromViolationException($exception);
        } catch (RequestException $exception) {
            $this->exceptionHandler->throwServiceExceptionFromRequestException($exception);
        } catch (\Throwable $exception) {
            $this->exceptionHandler->throwServiceException($exception);
        }
    }
673051
protected function call($command, array $options = array())
	{
		$curl = curl_init();
		$options[CURLOPT_URL] = $this->command_url($command);
		$options[CURLOPT_RETURNTRANSFER] = TRUE;
		$options[CURLOPT_FOLLOWLOCATION] = TRUE;

		curl_setopt_array($curl, $options);

		$raw = '';

		Attempt::make(function() use ($curl, & $raw) {
			$raw = trim(curl_exec($curl));
			return curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200;
		});

		$error = curl_error($curl);
		$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

		curl_close($curl);

		if ($error)
			throw new Exception_Driver('Curl ":command" throws exception :error', array(':command' => $command, ':error' => $error));

		if ($code != 200)
			throw new Exception_Driver('Unexpected response from the panthomjs for :command: :code', array(':command' => $command, ':code' => $code));

		$result = json_decode($raw, TRUE);

		return $result;
	}
338493
function callbackCommandRegister(\CharlotteDunois\Livia\Commands\Command $command) {
        foreach($this->settings as $guild => $settings) {
            if($guild !== 'global' && !$this->client->guilds->has($guild)) {
                continue;
            }
            
            $this->setupGuildCommand($guild, $command, $settings);
        }
    }
1128473
protected function registerMakeRequestCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\RequestMakeCommand($app);
        });
    }
1115048
public function trigger($keys, $callable)
	{
		$keys = is_array($keys) ? $keys : array($keys);

		// add triggers for all arguments
		foreach($keys as $key)
		{
			$this->_triggers[$key] = $callable;
		}

		return $this;
	}
858172
protected function callForOption($optionName, callable $callable)
    {
        $value = $this->input->getOption($optionName);
        if ($value) {
            call_user_func_array($callable, [$value]);
        }
    }
180798
public function call(callable $callable, array $parameters = [])
	{
		if(is_array($callable))
		{
			$reflection = new ReflectionMethod($callable[0], $callable[1]);
		}
		else
		{
			$reflection = new ReflectionFunction($callable);
		}

		return $callable(...$this->resolveParameters($reflection->getParameters(), $parameters));
	}
387792
public function callCommand(string $command, array $arguments = [])
    {
        $newCommand = $this->getApplication()->find($command);

        $arguments['command'] = $command;

        return $newCommand->run(new ArrayInput($arguments), $this->getOutput());
    }
1107523
private function executeCommand(array $command, array $options)
    {
        return $this
            ->getCommandExecutor()
            ->executeCommand(
                $this->manager,
                $this->databaseName,
                $command,
                $options
            );
    }
1229192
protected function registerMakeMailCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\MailMakeCommand($app);
        });
    }
1169859
public static function register($command, $callback)
    {
        if (!is_string($command) || strlen($command) < 1) {
            throw new BadMethodCallException('Parameter command is not a valid string');
        }
        if (!is_callable($callback)) {
            throw new BadMethodCallException('Parameter callback is not a valid callback');
        }

        $instance = self::getInstance();
        
        $instance->commands[$command] = $callback;
        
        return $instance;
    }
707453
public function removeHook($command, $callable)
    {
        if (isset($this->hooks[$command]) &&
            array_search($callable, $this->hooks[$command]) !== false
        ) {
            $hook = array_search($callable, $this->hooks[$command]);
            unset($this->hooks[$command][$hook]);
            unset($hook);
        }
    }