/** * @throws \Exception */ public function execute() { //@codingStandardsIgnoreStart $ch = curl_init(); $this->setAuth($ch); try { switch (strtoupper($this->verb)) { case 'GET': $this->executeGet($ch); break; case 'POST': $this->executePost($ch); break; case 'PUT': $this->executePut($ch); break; case 'DELETE': $this->executeDelete($ch); break; default: throw new \InvalidArgumentException('Current verb (' . $this->verb . ') is an invalid REST verb.'); } } catch (\InvalidArgumentException $e) { curl_close($ch); throw $e; } catch (\Exception $e) { curl_close($ch); throw $e; //@codingStandardsIgnoreEnd } /* * check and debug api request total time */ if ($this->helper->isDebugEnabled()) { $info = $this->getResponseInfo(); //the response info data is set if (isset($info['url']) && isset($info['total_time'])) { $url = $info['url']; $time = $info['total_time']; $totalTime = sprintf(' time : %g sec', $time); $check = $this->helper->getApiResponseTimeLimit(); $limit = $check ? $check : '2'; $message = $this->verb . ', ' . $url . $totalTime; //check for slow queries if ($time > $limit) { //log the slow queries $this->helper->log($message); } } } return $this->responseBody; }