示例#1
0
 /**
  * {@inheritdoc}
  */
 public function fetchAll(ApiInterface $api, $method, array $parameters = array())
 {
     $isSearch = $api instanceof Search;
     // get the perPage from the api
     $perPage = $api->getPerPage();
     // set parameters per_page to GitHub max to minimize number of requests
     $api->setPerPage(100);
     $result = array();
     $result = call_user_func_array(array($api, $method), $parameters);
     $this->postFetch();
     if ($isSearch) {
         $result = isset($result['items']) ? $result['items'] : $result;
     }
     while ($this->hasNext()) {
         $next = $this->fetchNext();
         if ($isSearch) {
             $result = array_merge($result, $next['items']);
         } else {
             $result = array_merge($result, $next);
         }
     }
     // restore the perPage
     $api->setPerPage($perPage);
     return $result;
 }
 /**
  * {@inheritdoc}
  */
 public function fetchAll(ApiInterface $api, $method, array $parameters = array())
 {
     // get the perPage from the api
     $perPage = $api->getPerPage();
     // Set parameters per_page to GitHub max to minimize number of requests
     $api->setPerPage(100);
     $result = array();
     $result = call_user_func_array(array($api, $method), $parameters);
     $this->postFetch();
     while ($this->hasNext()) {
         $result = array_merge($result, $this->fetchNext());
     }
     // restore the perPage
     $api->setPerPage($perPage);
     return $result;
 }