Example #1
0
 public function apiPullRequests()
 {
     $api = new API\Repositories\PullRequests();
     $api->setClient($this->httpClient);
     return $api;
 }
Example #2
0
 /**
  * Get the number of pull requests (Only for the default branch)
  * @param  string $owner owner of the repository
  * @param  string $repo  name of the repository
  * @param  string $state state of the pullRequest (OPEN,MERGED,DECLINED)
  * @return Number of pull requests
  */
 public function getRepositoryPullRequests($owner, $repo, $state)
 {
     $prs = [];
     $page = 1;
     $done = false;
     $pull = new PullRequests();
     while (!$done) {
         $response = $pull->all($owner, $repo, ['state' => $state, 'page' => $page, 'pagelen' => 50]);
         $res = json_decode($response->getContent(), true);
         $prs = array_merge($prs, $res['values']);
         if (count($res['values']) < 50) {
             $done = true;
         }
         $page++;
     }
     return $prs;
 }