Show the help information for a single SignatureHandler.

@param  Collection $handlers
@param  string $command
@return Response
184893
protected function displayHelpForCommand(Collection $handlers, string $command): Response
    {
        $helpRequest = clone $this->request;

        $helpRequest->text = $command;

        /** @var \Spatie\SlashCommand\Handlers $handler */
        $handler = $handlers->filter(function (HandlesSlashCommand $handler) use ($helpRequest) {
            return $handler->canHandle($helpRequest);
        })
            ->first();

        $field = AttachmentField::create($handler->getFullCommand(), $handler->getHelpDescription());

        return $this->respondToSlack('')
            ->withAttachment(
                Attachment::create()->addField($field)
            );
    }
20736
public function call( $command, array $parameters = [] )
	{
		$parameters = collect( $parameters )->prepend( $command );

		$this->lastOutput = new BufferedOutput;

		$this->setCatchExceptions( false );

		$result = $this->run( new ArrayInput( $parameters->toArray() ), $this->lastOutput );

		$this->setCatchExceptions( true );

		return $result;
	}
472492
public function event(Closure $command)
    {
        $response = $command();

        if ($this->resolveCommandResponse($response)) {
            EventReposity::add($response);
        }
    }
225009
protected function generateCommandUrl(string $command, array $parameters = [])
    {
        $query = '';
        if (!empty($parameters)) {
            $query = '?' . http_build_query($parameters);
        }

        return $this->ssoServerUrl . '/sso/' . $command . $query;
    }
655125
final protected function callArtisanCommand($command, array $params = [])
    {
        // Default input arguments
        $inputArguments = ['NodesInstall', $command];

        // Add artisan parameters to input arguments
        if (!empty($params) && is_array($params)) {
            $inputArguments[] = implode(' ', $params);
        }

        // Execute Artisan command
        return $this->getInstaller()->getArtisan()->handle(
            new SymfonyConsoleInput($inputArguments),
            new SymfonyConsoleOutput()
        );
    }
679438
public function commandsHandler($webhook = false, array $params = [])
    {
        if ($webhook) {
            $update = $this->getWebhookUpdate();
            $this->processCommand($update);

            return $update;
        }

        $updates = $this->getUpdates($params);
        $highestId = -1;

        foreach ($updates as $update) {
            $highestId = $update->getUpdateId();
            $this->processCommand($update);
        }

        //An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id.
        if ($highestId != -1) {
            $params = [];
            $params['offset'] = $highestId + 1;
            $params['limit'] = 1;
            $this->markUpdateAsRead($params);
        }

        return $updates;
    }
570915
public function handle($command)
    {
        $comment = $this->writeComment->by($command->userId)->withText($command->body)->about($command->ticketId)->get();
        $this->commentRepository->save($comment);

        $this->dispatchEventsFor($this->writeComment);

        return $comment;
    }
977988
public static function routeCommand($command = 'help')
	{
		// Aliases take precedence, so parse for them first
		if ($aliases = Config::get('aliases'))
		{
			if (array_key_exists($command, $aliases))
			{
				if (strpos($aliases->$command, '::') !== false)
				{
					$bits      = explode('::', $aliases->$command);
					$command   = $bits[0];
					$aliasTask = $bits[1];
				}
				else
				{
					$command = $aliases->$command;
				}
			}
		}

		foreach (self::$commandNamespaces as $namespace)
		{
			// Check if we're targeting a namespaced command
			$bits = [];
			if (strpos($command, ':'))
			{
				$bits = explode(':', $command);
			}
			else
			{
				$bits[] = $command;
			}

			$bits = array_map('ucfirst', $bits);

			// Replace any inset placeholders
			for ($i = 0; $i < count($bits); $i++)
			{
				$loc = $i + 1;
				if (strpos($namespace, "{\$$loc}"))
				{
					$namespace = str_replace("{\$$loc}", $bits[$i], $namespace);
					unset($bits[$i]);
				}
			}

			// Add any remaining bits to the end of the command namespace
			if (count($bits) > 0)
			{
				$namespace .= '\\' . implode('\\', $bits);
			}

			// Check for existence
			if (class_exists($namespace))
			{
				$class = $namespace;
				break;
			}
		}

		if (!isset($class))
		{
			throw new UnsupportedCommandException("Unknown command: {$command}.");
		}

		return $class;
	}
1075591
public function execute(Command $command)
    {
        $handler = $this->resolver->resolve($command);

        return $handler->handle($command);
    }
1312126
public static function simpleMapping($command, string $commandNamespace, string $handlerNamespace)
    {
        $command = str_replace($commandNamespace, '', get_class($command));

        return $handlerNamespace.'\\'.trim($command, '\\').'Handler';
    }
1341832
function defaultHandler(command) {
        debug(`executing default handler for unrecognized command ${command.commandText}`);
        if (!command.mention) {
            command.reply(`Command \`${command.command}\` is not recognized`);
        }
        return Promise.resolve();
    }
285224
private function call($command)
    {
        if (!in_array($command, static::COMMAND)) {
            $this->throwFailsCommand("The command '$command' not exists.", 'help');
        }

        if (!$this->arg->getParameter('action')) {
            if ($this->arg->getParameter('target') == 'help') {
                $this->help($command);

                exit(0);
            }
        }

        try {
            call_user_func_array(
                [$this, $command],
                [$this->arg->getParameter('target')]
            );
        } catch (\Exception $e) {
            echo $e->getMessage();

            exit(1);
        }
    }
507074
public function toCommandHandler($command)
    {
        $commandClass = get_class($command);
        $handler = substr_replace($commandClass, 'CommandHandler', strrpos($commandClass, 'Command'));

        if ( ! class_exists($handler))
        {
            $message = "Command handler [$handler] does not exist.";

            throw new HandlerNotRegisteredException($message);
        }

        return $handler;
    }
897208
public function commandToRequestTransformer(CommandInterface $command)
    {
        $name = $command->getName();
        if (!isset($this->api[$name])) {
            throw new CommandException('Command not found', $command);
        }
        $action = $this->api[$name];

        $prefix = '';
        if (isset($action['public']) && $command->hasParam('public')) {
            $prefix = '/public';
        }

        $prefixes = [
            'system' => '/systems/{system}',
            'issuer' => '/issuers/{issuer}',
            'program' => '/programs/{program}',
        ];
        if (isset($action['admin_contexts'])) {
            $prefix .= implode('', array_intersect_key($prefixes, array_flip($action['admin_contexts']), array_merge($command->toArray(), $this->adminContext)));
        }
        $path = GuzzleHttp\uri_template($prefix.$action['path'], array_merge($command->toArray(), $this->adminContext));

        $headers = [];
        $body = null;
        if ($command->hasParam('body')) {
            $headers = ['Content-Type' => 'application/json'];
            $body = GuzzleHttp\json_encode($command['body']);
        }

        if ($command->hasParam('query')) {
            $path .= '?'.Psr7\build_query($command['query']);
        }

        return new Psr7\Request($action['method'], $path, $headers, $body);
    }
125996
protected function registerMakeListenerCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\ListenerMakeCommand($app);
        });
    }
215121
protected function findAvailableHandlers(): Collection
    {
        return collect(config('laravel-slack-slash-command.handlers'))
            ->map(function (string $handlerClassName) {
                return new $handlerClassName($this->request);
            })
            ->filter(function (HandlesSlashCommand $handler) {
                return $handler instanceof SignatureHandler;
            })
            ->filter(function (SignatureHandler $handler) {
                $signatureParts = new SignatureParts($handler->getSignature());

                return Str::is($signatureParts->getSlashCommandName(), $this->request->command);
            });
    }
39838
protected function help($command = null)
    {
        if ($command && isset(self::$help[$command])) {
            $data = self::$help[$command];
        } else {
            $data = self::$fallbackHelp;
        }

        return $this->render('system/cli/help.phtml', $data);
    }