Skip to content

Commit 989bc2c

Browse files
author
Matt Humphrey
committed
Remove ApiInterface. CS fixes in Api directory
1 parent 6ccedb4 commit 989bc2c

File tree

14 files changed

+593
-67
lines changed

14 files changed

+593
-67
lines changed

lib/Gitlab/Api/AbstractApi.php

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
<?php
2-
3-
namespace Gitlab\Api;
1+
<?php namespace Gitlab\Api;
42

53
use Gitlab\Client;
64

75
/**
86
* Abstract class for Api classes
97
*
108
* @author Joseph Bielawski <stloyd@gmail.com>
9+
* @author Matt Humphrey <matt@m4tt.co>
1110
*/
12-
abstract class AbstractApi implements ApiInterface
11+
abstract class AbstractApi
1312
{
1413
/**
1514
* Default entries per page
@@ -31,12 +30,19 @@ public function __construct(Client $client)
3130
$this->client = $client;
3231
}
3332

33+
/**
34+
* @return $this
35+
*/
3436
public function configure()
3537
{
38+
return $this;
3639
}
3740

3841
/**
39-
* {@inheritDoc}
42+
* @param string $path
43+
* @param array $parameters
44+
* @param array $requestHeaders
45+
* @return mixed
4046
*/
4147
protected function get($path, array $parameters = array(), $requestHeaders = array())
4248
{
@@ -46,7 +52,10 @@ protected function get($path, array $parameters = array(), $requestHeaders = arr
4652
}
4753

4854
/**
49-
* {@inheritDoc}
55+
* @param string $path
56+
* @param array $parameters
57+
* @param array $requestHeaders
58+
* @return mixed
5059
*/
5160
protected function post($path, array $parameters = array(), $requestHeaders = array())
5261
{
@@ -56,7 +65,10 @@ protected function post($path, array $parameters = array(), $requestHeaders = ar
5665
}
5766

5867
/**
59-
* {@inheritDoc}
68+
* @param string $path
69+
* @param array $parameters
70+
* @param array $requestHeaders
71+
* @return mixed
6072
*/
6173
protected function patch($path, array $parameters = array(), $requestHeaders = array())
6274
{
@@ -66,7 +78,10 @@ protected function patch($path, array $parameters = array(), $requestHeaders = a
6678
}
6779

6880
/**
69-
* {@inheritDoc}
81+
* @param string $path
82+
* @param array $parameters
83+
* @param array $requestHeaders
84+
* @return mixed
7085
*/
7186
protected function put($path, array $parameters = array(), $requestHeaders = array())
7287
{
@@ -76,7 +91,10 @@ protected function put($path, array $parameters = array(), $requestHeaders = arr
7691
}
7792

7893
/**
79-
* {@inheritDoc}
94+
* @param string $path
95+
* @param array $parameters
96+
* @param array $requestHeaders
97+
* @return mixed
8098
*/
8199
protected function delete($path, array $parameters = array(), $requestHeaders = array())
82100
{

lib/Gitlab/Api/ApiInterface.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

lib/Gitlab/Api/Groups.php

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
<?php
2-
3-
namespace Gitlab\Api;
1+
<?php namespace Gitlab\Api;
42

53
class Groups extends AbstractApi
64
{
5+
/**
6+
* @param int $page
7+
* @param int $per_page
8+
* @return mixed
9+
*/
710
public function all($page = 1, $per_page = self::PER_PAGE)
811
{
912
return $this->get('groups', array(
@@ -12,11 +15,20 @@ public function all($page = 1, $per_page = self::PER_PAGE)
1215
));
1316
}
1417

18+
/**
19+
* @param int $id
20+
* @return mixed
21+
*/
1522
public function show($id)
1623
{
1724
return $this->get('groups/'.urlencode($id));
1825
}
1926

27+
/**
28+
* @param string $name
29+
* @param string $path
30+
* @return mixed
31+
*/
2032
public function create($name, $path)
2133
{
2234
return $this->post('groups', array(
@@ -25,11 +37,22 @@ public function create($name, $path)
2537
));
2638
}
2739

40+
/**
41+
* @param int $group_id
42+
* @param int $project_id
43+
* @return mixed
44+
*/
2845
public function transfer($group_id, $project_id)
2946
{
3047
return $this->post('groups/'.urlencode($group_id).'/projects/'.urlencode($project_id));
3148
}
3249

50+
/**
51+
* @param int $id
52+
* @param int $page
53+
* @param int $per_page
54+
* @return mixed
55+
*/
3356
public function members($id, $page = 1, $per_page = self::PER_PAGE)
3457
{
3558
return $this->get('groups/'.urlencode($id).'/members', array(
@@ -38,6 +61,12 @@ public function members($id, $page = 1, $per_page = self::PER_PAGE)
3861
));
3962
}
4063

64+
/**
65+
* @param int $group_id
66+
* @param int $user_id
67+
* @param int $access_level
68+
* @return mixed
69+
*/
4170
public function addMember($group_id, $user_id, $access_level)
4271
{
4372
return $this->post('groups/'.urlencode($group_id).'/members', array(
@@ -46,6 +75,11 @@ public function addMember($group_id, $user_id, $access_level)
4675
));
4776
}
4877

78+
/**
79+
* @param int $group_id
80+
* @param int $user_id
81+
* @return mixed
82+
*/
4983
public function removeMember($group_id, $user_id)
5084
{
5185
return $this->delete('groups/'.urlencode($group_id).'/members/'.urlencode($user_id));

lib/Gitlab/Api/Issues.php

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
<?php
2-
3-
namespace Gitlab\Api;
1+
<?php namespace Gitlab\Api;
42

53
class Issues extends AbstractApi
64
{
5+
/**
6+
* @param int $project_id
7+
* @param int $page
8+
* @param int $per_page
9+
* @param array $params
10+
* @return mixed
11+
*/
712
public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, array $params = array())
813
{
914
$path = $project_id === null ? 'issues' : 'projects/'.urlencode($project_id).'/issues';
@@ -17,29 +22,55 @@ public function all($project_id = null, $page = 1, $per_page = self::PER_PAGE, a
1722
return $this->get($path, $params);
1823
}
1924

25+
/**
26+
* @param int $project_id
27+
* @param int $issue_id
28+
* @return mixed
29+
*/
2030
public function show($project_id, $issue_id)
2131
{
2232
return $this->get('projects/'.urlencode($project_id).'/issues/'.urlencode($issue_id));
2333
}
2434

35+
/**
36+
* @param int $project_id
37+
* @param array $params
38+
* @return mixed
39+
*/
2540
public function create($project_id, array $params)
2641
{
2742
return $this->post('projects/'.urlencode($project_id).'/issues', $params);
2843
}
2944

45+
/**
46+
* @param int $project_id
47+
* @param int $issue_id
48+
* @param array $params
49+
* @return mixed
50+
*/
3051
public function update($project_id, $issue_id, array $params)
3152
{
3253
return $this->put('projects/'.urlencode($project_id).'/issues/'.urlencode($issue_id), $params);
3354
}
3455

56+
/**
57+
* @param int $project_id
58+
* @param int $issue_id
59+
* @return mixed
60+
*/
3561
public function showComments($project_id, $issue_id)
3662
{
3763
return $this->get('projects/'.urlencode($project_id).'/issues/'.urlencode($issue_id).'/notes');
3864
}
3965

66+
/**
67+
* @param int $project_id
68+
* @param int $issue_id
69+
* @param array $params
70+
* @return mixed
71+
*/
4072
public function addComment($project_id, $issue_id, array $params)
4173
{
4274
return $this->post('projects/'.urlencode($project_id).'/issues/'.urlencode($issue_id).'/notes', $params);
4375
}
44-
4576
}

lib/Gitlab/Api/MergeRequests.php

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<?php
2-
3-
namespace Gitlab\Api;
1+
<?php namespace Gitlab\Api;
42

53
class MergeRequests extends AbstractApi
64
{
@@ -9,31 +7,70 @@ class MergeRequests extends AbstractApi
97
const STATE_OPENED = 'opened';
108
const STATE_CLOSED = 'closed';
119

10+
/**
11+
* @param int $project_id
12+
* @param int $page
13+
* @param int $per_page
14+
* @return mixed
15+
*/
1216
public function all($project_id, $page = 1, $per_page = self::PER_PAGE)
1317
{
1418
return $this->getMrList($project_id, $page, $per_page, self::STATE_ALL);
1519
}
1620

21+
/**
22+
* @param int $project_id
23+
* @param int $page
24+
* @param int $per_page
25+
* @return mixed
26+
*/
1727
public function merged($project_id, $page = 1, $per_page = self::PER_PAGE)
1828
{
1929
return $this->getMrList($project_id, $page, $per_page, self::STATE_MERGED);
2030
}
2131

32+
/**
33+
* @param int $project_id
34+
* @param int $page
35+
* @param int $per_page
36+
* @return mixed
37+
*/
2238
public function opened($project_id, $page = 1, $per_page = self::PER_PAGE)
2339
{
2440
return $this->getMrList($project_id, $page, $per_page, self::STATE_OPENED);
2541
}
2642

43+
/**
44+
* @param int $project_id
45+
* @param int $page
46+
* @param int $per_page
47+
* @return mixed
48+
*/
2749
public function closed($project_id, $page = 1, $per_page = self::PER_PAGE)
2850
{
2951
return $this->getMrList($project_id, $page, $per_page, self::STATE_CLOSED);
3052
}
3153

54+
/**
55+
* @param int $project_id
56+
* @param int $mr_id
57+
* @return mixed
58+
*/
3259
public function show($project_id, $mr_id)
3360
{
3461
return $this->get('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id));
3562
}
3663

64+
/**
65+
* @param int $project_id
66+
* @param string $source
67+
* @param string $target
68+
* @param string $title
69+
* @param int $assignee
70+
* @param int $target_project_id
71+
* @param string $description
72+
* @return mixed
73+
*/
3774
public function create($project_id, $source, $target, $title, $assignee = null, $target_project_id = null, $description = null)
3875
{
3976
if ($target_project_id && ! is_numeric($target_project_id)) {
@@ -50,28 +87,58 @@ public function create($project_id, $source, $target, $title, $assignee = null,
5087
));
5188
}
5289

90+
/**
91+
* @param int $project_id
92+
* @param int $mr_id
93+
* @param array $params
94+
* @return mixed
95+
*/
5396
public function update($project_id, $mr_id, array $params)
5497
{
5598
return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id), $params);
5699
}
57100

101+
/**
102+
* @param int $project_id
103+
* @param int $mr_id
104+
* @param array $params
105+
* @return mixed
106+
*/
58107
public function merge($project_id, $mr_id, array $params)
59108
{
60109
return $this->put('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/merge', $params);
61110
}
62111

112+
/**
113+
* @param int $project_id
114+
* @param int $mr_id
115+
* @return mixed
116+
*/
63117
public function showComments($project_id, $mr_id)
64118
{
65119
return $this->get('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/comments');
66120
}
67121

122+
/**
123+
* @param int $project_id
124+
* @param int $mr_id
125+
* @param int $note
126+
* @return mixed
127+
*/
68128
public function addComment($project_id, $mr_id, $note)
69129
{
70130
return $this->post('projects/'.urlencode($project_id).'/merge_request/'.urlencode($mr_id).'/comments', array(
71131
'note' => $note
72132
));
73133
}
74134

135+
/**
136+
* @param int $project_id
137+
* @param int $page
138+
* @param int $per_page
139+
* @param string $state
140+
* @return mixed
141+
*/
75142
protected function getMrList($project_id, $page, $per_page, $state = self::STATE_ALL)
76143
{
77144
return $this->get('projects/'.urlencode($project_id).'/merge_requests', array(

0 commit comments

Comments
 (0)