From 2aafb2cc4e0130cc0965ab0541ee979ace83f8db Mon Sep 17 00:00:00 2001 From: Dan Barrett Date: Sun, 5 Jan 2014 00:00:39 +1100 Subject: [PATCH] Added contributor commit statistics for repository Added contributor statics for commits for a specified repository as per http://developer.github.com/v3/repos/statistics/#contributors Not sure if it's in the right file, but it's a handy function to have. --- lib/Github/Api/Repo.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/Github/Api/Repo.php b/lib/Github/Api/Repo.php index ae43470ebe3..047b213c048 100644 --- a/lib/Github/Api/Repo.php +++ b/lib/Github/Api/Repo.php @@ -37,6 +37,20 @@ public function find($keyword, array $params) { return $this->get('legacy/repos/search/'.rawurlencode($keyword), array_merge(array('start_page' => 1), $params)); } + + /** + * Get contributor commit statistics for a repository + * @link http://developer.github.com/v3/repos/statistics/#contributors + * + * @param string $username the user who owns the repository + * @param string $repository the name of the repository + * + * @return array list of contributors and their commit statistics + */ + public function statistics($username, $repository) + { + return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/stats/contributors'); + } /** * List all repositories for an organization