forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForks.php
More file actions
27 lines (22 loc) · 785 Bytes
/
Copy pathForks.php
File metadata and controls
27 lines (22 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
/**
* @link http://developer.github.com/v3/repos/forks/
*
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class Forks extends AbstractApi
{
public function all($username, $repository, array $params = [])
{
if (isset($params['sort']) && !in_array($params['sort'], ['newest', 'oldest', 'watchers'])) {
$params['sort'] = 'newest';
}
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', array_merge(['page' => 1], $params));
}
public function create($username, $repository, array $params = [])
{
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/forks', $params);
}
}