Example #1
0
 /**
  * Get the number of commits of the repo
  * @param  string $owner owner of the repository
  * @param  string $repo  name of the repository
  * @return Number of commits
  */
 public function getRepositoryCommits($owner, $repo)
 {
     $commits = [];
     $page = 1;
     $done = false;
     $commit = new Commits();
     while (!$done) {
         $response = $commit->all($owner, $repo, ['page' => $page, 'pagelen' => 50]);
         $res = json_decode($response->getContent(), true);
         $commits = array_merge($commits, $res['values']);
         if (count($res['values']) < 50) {
             $done = true;
         }
         $page++;
     }
     return $commits;
 }
Example #2
0
 public function apiCommits()
 {
     $api = new API\Repositories\Commits();
     $api->setClient($this->httpClient);
     return $api;
 }