curlExec() публичный статический Метод

Call curl_exec() with supported redirect on safe_mode or open_basedir
Автор: Naoki Sawada
public static curlExec ( resource $curl, array $options = [], array $headers = [] ) : mixed
$curl resource
$options array
$headers array
Результат mixed
 /**
  * Call curl_exec().
  *
  * @param resource    $curl
  * @param bool|string $decodeOrParent
  * @param array       $headers
  *
  * @throws \Exception
  *
  * @return mixed
  */
 protected function _bd_curlExec($curl, $decodeOrParent = true, $headers = array())
 {
     $headers = array_merge(array('Authorization: Bearer ' . $this->token->data->access_token), $headers);
     $result = elFinder::curlExec($curl, array(), $headers);
     if (!$decodeOrParent) {
         return $result;
     }
     $decoded = json_decode($result);
     if (!empty($decoded->error_code)) {
         $errmsg = $decoded->error_code;
         if (!empty($decoded->message)) {
             $errmsg .= ': ' . $decoded->message;
         }
         throw new \Exception($errmsg);
     }
     // make catch
     if ($decodeOrParent && $decodeOrParent !== true) {
         $raws = null;
         list(, $parentId) = $this->_bd_splitPath($decodeOrParent);
         if (isset($decoded->entries)) {
             $raws = $decoded->entries;
         } elseif (isset($decoded->id)) {
             $raws = array($decoded);
         }
         if ($raws) {
             foreach ($raws as $raw) {
                 if (isset($raw->id)) {
                     $stat = $this->_bd_parseRaw($raw);
                     $itemPath = $this->_joinPath($decodeOrParent, $raw->id);
                     $this->updateCache($itemPath, $stat);
                 }
             }
         }
     }
     return $decoded;
 }