/** * Process and client settings. */ protected function setOptions() { $this->resource->setOption(CURLOPT_URL, $this->createUrl()); $this->resource->setOption(CURLOPT_CUSTOMREQUEST, $this->request->getMethod()); $this->resource->setOption(CURLOPT_RETURNTRANSFER, true); $this->resource->setOption(CURLOPT_HEADER, true); $this->resource->setOption(CURLOPT_FOLLOWLOCATION, $this->options->get(HttpClientOptions::FOLLOW_REDIRECT, false)); if ($this->options->get(HttpClientOptions::VERIFY_SSL, true)) { $this->resource->setOption(CURLOPT_SSL_VERIFYPEER, true); $this->resource->setOption(CURLOPT_SSL_VERIFYHOST, 2); } else { $this->resource->setOption(CURLOPT_SSL_VERIFYPEER, false); $this->resource->setOption(CURLOPT_SSL_VERIFYHOST, false); } foreach ($this->options->toArray() as $option => $value) { if (str_starts_with($option, 'CURLOPT_') && defined($option)) { $this->resource->setOption(constant($option), $value); } } }
/** * @param IHttpRequest $request * * @return IHttpResponse */ public function handle(IHttpRequest $request) { $route = $this->router->match($request->getMethod(), $request->getUrl()); return $this->routesInvoker->invoke($route); }