Execute current command.

@param ApiResourceInterface $resource

@return ResponseInterface
545173
protected function execute(ApiResourceInterface $resource)
    {
        $client = $resource->getHttpClient();

        if (is_null($options = $this->requestOptions())) {
            return $client->request($this->requestMethod(), $this->requestUrl($resource));
        }

        return $client->request($this->requestMethod(), $this->requestUrl($resource), $options);
    }
694970
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $files = $input->getArgument('files');
        $fileSuffix = ' -f ' . implode(' -f ', $files);

        $command = sprintf('%s stop -d', $fileSuffix);
        $response = $this->getFacade()->runDockerCompose($command);

        if ($output->isVerbose()) {
            $output->writeln($response);
        }
    }
624894
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $input = $this->input($request);

        $payload = $this->domain->payload($input);

        return $this->responder->response($request, $payload);
    }
353341
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if (false === $this->booted) {
            $this->boot();
        }

        try {
            return $this->pipe->handle($request);
        } catch (Exception $e) {
            $this->getContainer()->get('logger')->error($e);
        }
    }
1099596
public function handle($request, Closure $next, $apiVersion, $apiName = null)
    {
        APIResource::setVersion($apiVersion, $apiName);
        return $next($request);
    }
259192
public function add(ResourceInterface $resource)
    {
        $this->resources[$resource->getName()] = $resource;
        $this->indexes[] = $resource->getName();

        return $this;
    }
209652
public function get(string $resource): Promise {
        return call(function () use ($resource) {
            $uri = yield $this->getResourceUri($resource);

            $this->logger->debug('Requesting {uri} via GET', [
                'uri' => $uri,
            ]);

            try {
                /** @var Response $response */
                $response = yield $this->http->request($uri);

                // We just buffer the body here, so no further I/O will happen once this method's promise resolves.
                $body = yield $response->getBody();

                $this->logger->debug('Request for {uri} via GET has been processed with status {status}: {body}', [
                    'uri' => $uri,
                    'status' => $response->getStatus(),
                    'body' => $body
                ]);

                $this->saveNonce($response);
            } catch (Throwable $e) {
                throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e);
            } catch (Exception $e) {
                throw new AcmeException("GET request to {$uri} failed: " . $e->getMessage(), null, $e);
            }

            return $response;
        });
    }
517429
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->execute([$request, $handler]);
    }
604821
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getApplication()->getContainer();

        $container->setParam(
            'formatter.name',
            $input->getOption('format') ?: $container->getParam('formatter.name')
        );
        $container->configure();

        $locator = $input->getArgument('spec');
        $linenum = null;
        if (preg_match('/^(.*)\:(\d+)$/', $locator, $matches)) {
            list($_, $locator, $linenum) = $matches;
        }

        $suite       = $container->get('loader.resource_loader')->load($locator, $linenum);
        $suiteRunner = $container->get('runner.suite');

        return $container->get('console.result_converter')->convert(
            $suiteRunner->run($suite)
        );
    }
426507
public function run(RequestInterface $request = null, ResponseInterface $response = null)
    {

        if (is_null($request)) {
            if (!$this->getContainer()->has('request')) {
                if ($this->getContainer()->has('Psr\Http\Message\ServerRequestInterface')) {
                    $this->getContainer()->add('request', 'Psr\Http\Message\ServerRequestInterface');
                } else if ($this->getContainer()->has('Psr\Http\Message\RequestInterface')) {
                    $this->getContainer()->add('request', 'Psr\Http\Message\RequestInterface');
                }
            }
            $request = $this->getContainer()->get('request');
        }
        if (is_null($response)) {
            if (!$this->getContainer()->has('response') && $this->getContainer()->has('Psr\Http\Message\ResponseInterface')) {
                $this->getContainer()->add('response', 'Psr\Http\Message\ResponseInterface');
            }
            $response = $this->getContainer()->get('response');
        }

        $this->getContainer()->add('request', $request);
        $this->getContainer()->add('response', $response);

        $this->setErrorHandler();
        $this->getKernel()->run($request, $response);

        if ($this->getLogger()) {
            if ($request instanceof ServerRequestInterface) {
                $this->getLogger()->debug('Script execution time: '.number_format(microtime(true) - $request->getServerParams()['REQUEST_TIME_FLOAT'], 3).' s');
            }
            $this->getLogger()->debug('Memory usage: '.number_format(memory_get_usage()/1024/1024, 3).' MB.');
        }
    }
1192148
public function update($name, $id, HttpResourceInterface $resource)
    {
        $definition = $this->capabilities->get($name);
        $this->client->update(
            $definition->getUrl() . (string) $id,
            $resource
        );

        return $this;
    }
385139
public function addResource(ResourceInterface $resource, $name = null) {
		if ($name === null) {
			$this->resources[] = $resource;
			
			return $this;
		}
		
		$this->resources[$name] = $resource;
		
		return $this;
	}
689124
public function execute(InputInterface $input, OutputInterface $output)
    {
        $uri = $input->getArgument('uri');

        $data = $input->getParameterOption(['--data', '-d']);
        if (file_exists($data)) {
            $data = file_get_contents($data);
        }

        client()->createRequest($uri);

        if (false === strpos(client()->getProtocol(), 'http') && empty($data)) {
            $data = ' ';
        }

        $response = client()->send($data);

        if ($input->hasParameterOption(['--json'])) {
            $json = $response->getContents();
            $header = '';
            foreach ($response->getHeaders() as $key => $value) {
                $header .= $key.': '.$response->getHeaderLine($key).PHP_EOL;
            }
            $response = $header."\r\n".json_encode(json_decode($json, true), JSON_PRETTY_PRINT);
        } elseif (false !== strpos(client()->getProtocol(), 'http')) {
            $response = (string) $response;
        } else {
            $response = $response->getContents();
        }

        $output->writeln($response);

        return 0;
    }
122566
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $command = sprintf(
            'exec -i %s %s',
            $input->getArgument('container'),
            $input->getArgument('execcmd')
        );

        $response = $this->getFacade()->runDocker($command);

        if ($output->isVerbose()) {
            $output->writeln($response);
        }
    }
876774
public function dispatch(RequestInterface $request, ResponseInterface $response = null)
    {
        if (!($request instanceof ConsoleRequest)) {
            throw new \RuntimeException('You can use this controller only from a console!');
        }

        return parent::dispatch($request, $response);
    }
419662
public function execute(InputInterface $input, OutputInterface $output)
    {
        $argument = $input->getArgument($this->argumentName);
        $path = $this->basePath.'/'.$argument.'.php';

        if ($input->hasOption('restful') && $input->getOption('restful') == true) {
            $this->restful = true;
        } else {
            $this->restful = false;
        }

        $response = $this->runFileGeneratorCommand($path, $argument);

        if ($response === true) {
            $this->type ?: $this->type = 'Command';
            $output->writeln(ucfirst($this->type).' created successfully');

            return;
        }
        $output->writeln($response);
    }
1014420
public function create($name, HttpResourceInterface $resource)
    {
        $this->client->create(
            $this->capabilities->get($name)->getUrl(),
            $resource
        );

        return $this;
    }