1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the bitbucket-api package. |
4
|
|
|
* |
5
|
|
|
* (c) Alexandru Guzinschi <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
namespace Bitbucket\API\Repositories\Refs; |
11
|
|
|
|
12
|
|
|
use Bitbucket\API; |
13
|
|
|
use Buzz\Message\MessageInterface; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @author Kevin Howe <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
class Branches extends API\Api |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Get a list of branches |
22
|
|
|
* |
23
|
|
|
* @access public |
24
|
|
|
* @param string $account The team or individual account owning the repository. |
25
|
|
|
* @param string $repo The repository identifier. |
26
|
|
|
* @param string|array $params GET parameters |
27
|
|
|
* @return MessageInterface |
28
|
|
|
* |
29
|
|
|
* @throws \InvalidArgumentException |
30
|
|
|
*/ |
31
|
2 |
|
public function all($account, $repo, $params = array()) |
32
|
|
|
{ |
33
|
2 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
34
|
2 |
|
sprintf('repositories/%s/%s/refs/branches', $account, $repo), |
35
|
|
|
$params |
36
|
2 |
|
); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Get an individual branch |
41
|
|
|
* |
42
|
|
|
* @access public |
43
|
|
|
* @param string $account The team or individual account owning the repository. |
44
|
|
|
* @param string $repo The repository identifier. |
45
|
|
|
* @param string $name The branch identifier. |
46
|
|
|
* @return MessageInterface |
47
|
|
|
* |
48
|
|
|
* @throws \InvalidArgumentException |
49
|
|
|
*/ |
50
|
1 |
|
public function get($account, $repo, $name) |
51
|
|
|
{ |
52
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
53
|
1 |
|
sprintf('repositories/%s/%s/refs/branches/%s', $account, $repo, $name) |
54
|
1 |
|
); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|