Пример #1
0
 public function request($path, $body = null, $httpMethod = 'GET', array $headers = array(), array $options = array())
 {
     $path = $path . '?per_page=1000';
     $cache = $this->getCache();
     $has = $cache->has($path);
     if ($has && $this->maxage != 0) {
         if ($this->maxage < 0 || time() - $cache->getModifiedSince($path) <= $this->maxage) {
             return $cache->get($path);
         }
     }
     try {
         return parent::request($path, $body, $httpMethod, $headers, $options);
     } catch (Exception $e) {
         if ($has) {
             return $cache->get($path);
         } else {
             error_log("GitHub API request {$path} failed and no cache available! {$e}");
             throw $e;
         }
     }
 }