These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Part of the Joomla Framework Github Package |
||
4 | * |
||
5 | * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. |
||
6 | * @license GNU General Public License version 2 or later; see LICENSE |
||
7 | */ |
||
8 | |||
9 | namespace Joomla\Github\Package\Activity; |
||
10 | |||
11 | use Joomla\Github\AbstractPackage; |
||
12 | |||
13 | /** |
||
14 | * GitHub API Activity Events class for the Joomla Framework. |
||
15 | * |
||
16 | * @documentation http://developer.github.com/v3/activity/events/ |
||
17 | * |
||
18 | * @since 1.0 |
||
19 | */ |
||
20 | class Events extends AbstractPackage |
||
21 | { |
||
22 | /** |
||
23 | * List public events. |
||
24 | * |
||
25 | * @return object |
||
26 | * |
||
27 | * @since 1.0 |
||
28 | */ |
||
29 | public function getPublic() |
||
30 | { |
||
31 | // Build the request path. |
||
32 | $path = '/events'; |
||
33 | |||
34 | return $this->processResponse( |
||
35 | $this->client->get($this->fetchUrl($path)) |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * List repository events. |
||
41 | * |
||
42 | * @param string $owner Repository owner. |
||
43 | * @param string $repo Repository name. |
||
44 | * |
||
45 | * @return object |
||
46 | * |
||
47 | * @since 1.0 |
||
48 | */ |
||
49 | public function getRepository($owner, $repo) |
||
50 | { |
||
51 | // Build the request path. |
||
52 | $path = '/repos/' . $owner . '/' . $repo . '/events'; |
||
53 | |||
54 | return $this->processResponse( |
||
55 | $this->client->get($this->fetchUrl($path)) |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * List issue events for a repository. |
||
61 | * |
||
62 | * @param string $owner Repository owner. |
||
63 | * @param string $repo Repository name. |
||
64 | * |
||
65 | * @return object |
||
66 | * |
||
67 | * @since 1.0 |
||
68 | */ |
||
69 | public function getIssue($owner, $repo) |
||
70 | { |
||
71 | // Build the request path. |
||
72 | $path = '/repos/' . $owner . '/' . $repo . '/issues/events'; |
||
73 | |||
74 | return $this->processResponse( |
||
75 | $this->client->get($this->fetchUrl($path)) |
||
76 | ); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * List public events for a network of repositories. |
||
81 | * |
||
82 | * @param string $owner Repository owner. |
||
83 | * @param string $repo Repository name. |
||
84 | * |
||
85 | * @return object |
||
86 | * |
||
87 | * @since 1.0 |
||
88 | */ |
||
89 | public function getNetwork($owner, $repo) |
||
90 | { |
||
91 | // Build the request path. |
||
92 | $path = '/networks/' . $owner . '/' . $repo . '/events'; |
||
93 | |||
94 | return $this->processResponse( |
||
95 | $this->client->get($this->fetchUrl($path)) |
||
96 | ); |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * List public events for an organization. |
||
101 | * |
||
102 | * @param string $org Organization. |
||
103 | * |
||
104 | * @return object |
||
105 | * |
||
106 | * @since 1.0 |
||
107 | */ |
||
108 | View Code Duplication | public function getOrg($org) |
|
0 ignored issues
–
show
|
|||
109 | { |
||
110 | // Build the request path. |
||
111 | $path = '/orgs/' . $org . '/events'; |
||
112 | |||
113 | return $this->processResponse( |
||
114 | $this->client->get($this->fetchUrl($path)) |
||
115 | ); |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * List events that a user has received. |
||
120 | * |
||
121 | * These are events that you’ve received by watching repos and following users. |
||
122 | * If you are authenticated as the given user, you will see private events. |
||
123 | * Otherwise, you’ll only see public events. |
||
124 | * |
||
125 | * @param string $user User name. |
||
126 | * |
||
127 | * @return object |
||
128 | * |
||
129 | * @since 1.0 |
||
130 | */ |
||
131 | View Code Duplication | public function getUser($user) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
132 | { |
||
133 | // Build the request path. |
||
134 | $path = '/users/' . $user . '/received_events'; |
||
135 | |||
136 | return $this->processResponse( |
||
137 | $this->client->get($this->fetchUrl($path)) |
||
138 | ); |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * List public events that a user has received. |
||
143 | * |
||
144 | * @param string $user User name. |
||
145 | * |
||
146 | * @return object |
||
147 | * |
||
148 | * @since 1.0 |
||
149 | */ |
||
150 | View Code Duplication | public function getUserPublic($user) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
151 | { |
||
152 | // Build the request path. |
||
153 | $path = '/users/' . $user . '/received_events/public'; |
||
154 | |||
155 | return $this->processResponse( |
||
156 | $this->client->get($this->fetchUrl($path)) |
||
157 | ); |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * List events performed by a user. |
||
162 | * |
||
163 | * If you are authenticated as the given user, you will see your private events. |
||
164 | * Otherwise, you’ll only see public events. |
||
165 | * |
||
166 | * @param string $user User name. |
||
167 | * |
||
168 | * @return object |
||
169 | * |
||
170 | * @since 1.0 |
||
171 | */ |
||
172 | View Code Duplication | public function getByUser($user) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
173 | { |
||
174 | // Build the request path. |
||
175 | $path = '/users/' . $user . '/events'; |
||
176 | |||
177 | return $this->processResponse( |
||
178 | $this->client->get($this->fetchUrl($path)) |
||
179 | ); |
||
180 | } |
||
181 | |||
182 | /** |
||
183 | * List public events performed by a user. |
||
184 | * |
||
185 | * @param string $user User name. |
||
186 | * |
||
187 | * @return object |
||
188 | * |
||
189 | * @since 1.0 |
||
190 | */ |
||
191 | View Code Duplication | public function getByUserPublic($user) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
192 | { |
||
193 | // Build the request path. |
||
194 | $path = '/users/' . $user . '/events/public'; |
||
195 | |||
196 | return $this->processResponse( |
||
197 | $this->client->get($this->fetchUrl($path)) |
||
198 | ); |
||
199 | } |
||
200 | |||
201 | /** |
||
202 | * List events for an organization. |
||
203 | * |
||
204 | * This is the user’s organization dashboard. |
||
205 | * You must be authenticated as the user to view this. |
||
206 | * |
||
207 | * @param string $user User name. |
||
208 | * @param string $org Organisation. |
||
209 | * |
||
210 | * @return object |
||
211 | * |
||
212 | * @since 1.0 |
||
213 | */ |
||
214 | public function getUserOrg($user, $org) |
||
215 | { |
||
216 | // Build the request path. |
||
217 | $path = '/users/' . $user . '/events/orgs/' . $org; |
||
218 | |||
219 | return $this->processResponse( |
||
220 | $this->client->get($this->fetchUrl($path)) |
||
221 | ); |
||
222 | } |
||
223 | } |
||
224 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.