示例#1
0
 /**
  * @param array $data
  * @return int|mixed|null
  * @throws \ErrorException
  */
 protected function makeRequest(array $data = [])
 {
     $requestUrl = $this->getRequestURI();
     $result = null;
     switch ($this->requestHttpMethod()) {
         case self::METHOD_POST:
             $result = $this->curl->post($requestUrl, $data);
             break;
         case self::METHOD_GET:
             $result = $this->curl->get($requestUrl, $data);
             break;
         case self::METHOD_PUT:
             $result = $this->curl->put($requestUrl, $data);
             break;
         case self::METHOD_PATCH:
             $result = $this->curl->patch($requestUrl, $data);
             break;
         default:
             $this->curl->get($requestUrl, $data);
     }
     return $result;
 }