Repository navigation
Expand file tree
/
Copy pathProtection.php
More file actions
45 lines (41 loc) · 1.57 KB
/
Copy pathProtection.php
File metadata and controls
45 lines (41 loc) · 1.57 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
/**
* @link https://developer.github.com/v3/repos/branches/
* @author Brandon Bloodgood <bbloodgood@gmail.com>
*/
class Protection extends AbstractApi
{
/**
* Retrieves configured protection for the provided branch
*
* @link https://developer.github.com/v3/repos/branches/#get-branch-protection
*
* @param string $username The user who owns the repository
* @param string $repository The name of the repo
* @param string $branch The name of the branch
*
* @return array The branch protection information
*/
public function show($username, $repository, $branch)
{
return $this->get('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection');
}
/**
* Updates the repo's branch protection
*
* @link https://developer.github.com/v3/repos/branches/#update-branch-protection
*
* @param string $username The user who owns the repository
* @param string $repository The name of the repo
* @param string $branch The name of the branch
* @param array $params The branch protection information
*
* @return array The updated branch protection information
*/
public function update($username, $repository, $branch, array $params = array())
{
return $this->put('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/branches/'.rawurlencode($branch).'/protection', $params);
}
}