@@ -162,8 +162,7 @@ |
||
162 | 162 | * @param array $attachments |
163 | 163 | * @return Webhook |
164 | 164 | */ |
165 | - public function setAttachments($attachments) |
|
166 | - { |
|
165 | + public function setAttachments($attachments) { |
|
167 | 166 | if (!is_array($attachments)) { |
168 | 167 | throw new InvalidArgumentException('The attachments must be an array.'); |
169 | 168 | } |
@@ -145,7 +145,7 @@ |
||
145 | 145 | ]); |
146 | 146 | } |
147 | 147 | catch (RequestException $e) { |
148 | - throw new RuntimeException('The request to the webhook failed: '.$e->getMessage(), $e->getCode(), $e); |
|
148 | + throw new RuntimeException('The request to the webhook failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // We re-initialize the attachments to prevent any conflict with a future message. |
@@ -66,7 +66,7 @@ |
||
66 | 66 | /** |
67 | 67 | * {@inheritdoc} |
68 | 68 | * |
69 | - * @return Auth |
|
69 | + * @return \Psr\Http\Message\StreamInterface |
|
70 | 70 | */ |
71 | 71 | public function test() { |
72 | 72 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | "test" => $test |
40 | 40 | ); |
41 | 41 | |
42 | - if($token != NULL) { |
|
42 | + if ($token != NULL) { |
|
43 | 43 | $arguments["token"] = $token; |
44 | 44 | } |
45 | 45 | |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | try { |
50 | 50 | $client = new \GuzzleHttp\Client(); |
51 | 51 | $json_response = $client->request('GET', $this->getUrl(), []); |
52 | - $response = json_decode( $json_response->getBody() ); |
|
52 | + $response = json_decode($json_response->getBody()); |
|
53 | 53 | } |
54 | 54 | catch (RequestException $e) { |
55 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
55 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
56 | 56 | } |
57 | 57 | |
58 | - if($response->{'ok'} === FALSE) { |
|
59 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
58 | + if ($response->{'ok'} === FALSE) { |
|
59 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return $this; |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | try { |
77 | 77 | $client = new \GuzzleHttp\Client(); |
78 | 78 | $json_response = $client->request('GET', $this->getUrl(), []); |
79 | - $response = json_decode( $json_response->getBody() ); |
|
79 | + $response = json_decode($json_response->getBody()); |
|
80 | 80 | } |
81 | 81 | catch (RequestException $e) { |
82 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
82 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
83 | 83 | } |
84 | 84 | |
85 | - if($response->{'ok'} === FALSE) { |
|
86 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
85 | + if ($response->{'ok'} === FALSE) { |
|
86 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | return $json_response->getBody(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param float $ts |
24 | 24 | * @param string $channel |
25 | 25 | * @param string $as_user |
26 | - * @return Chat |
|
26 | + * @return \Psr\Http\Message\StreamInterface |
|
27 | 27 | */ |
28 | 28 | public function delete($ts, $channel, $as_user = NULL) { |
29 | 29 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $channel |
76 | 76 | * @param string $text |
77 | - * @return Chat |
|
77 | + * @return \Psr\Http\Message\StreamInterface |
|
78 | 78 | */ |
79 | 79 | public function meMessage($channel, $text) { |
80 | 80 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param string $icon_emoji |
130 | 130 | * @param float $thread_ts |
131 | 131 | * @param string $reply_broadcast |
132 | - * @return Chat |
|
132 | + * @return \Psr\Http\Message\StreamInterface |
|
133 | 133 | */ |
134 | 134 | public function postMessage($channel, $text, $parse = "none", $link_names = 1, $attachments = NULL, |
135 | 135 | $unfurl_links = TRUE, $unfurl_media = FALSE, $username = NULL, $as_user = TRUE, $icon_url = NULL, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param string $parse |
236 | 236 | * @param integer $link_names |
237 | 237 | * @param bool $as_user |
238 | - * @return Chat |
|
238 | + * @return \Psr\Http\Message\StreamInterface |
|
239 | 239 | */ |
240 | 240 | public function update($ts, $channel, $text, $attachments = NULL, $parse = "none", $link_names = 1, $as_user = TRUE) { |
241 | 241 |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | |
41 | 41 | // Set the arguments of the request |
42 | 42 | $arguments = array( |
43 | - "ts" => (string)$ts, |
|
43 | + "ts" => (string) $ts, |
|
44 | 44 | "channel" => $channel |
45 | 45 | ); |
46 | 46 | |
47 | - if($as_user != NULL) { |
|
47 | + if ($as_user != NULL) { |
|
48 | 48 | $arguments["as_user"] = $as_user; |
49 | 49 | } |
50 | 50 | |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | try { |
55 | 55 | $client = new \GuzzleHttp\Client(); |
56 | 56 | $json_response = $client->request('GET', $this->getUrl(), []); |
57 | - $response = json_decode( $json_response->getBody() ); |
|
57 | + $response = json_decode($json_response->getBody()); |
|
58 | 58 | } |
59 | 59 | catch (RequestException $e) { |
60 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
60 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
61 | 61 | } |
62 | 62 | |
63 | - if($response->{'ok'} === FALSE) { |
|
64 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
63 | + if ($response->{'ok'} === FALSE) { |
|
64 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $json_response->getBody(); |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | try { |
99 | 99 | $client = new \GuzzleHttp\Client(); |
100 | 100 | $json_response = $client->request('GET', $this->getUrl(), []); |
101 | - $response = json_decode( $json_response->getBody() ); |
|
101 | + $response = json_decode($json_response->getBody()); |
|
102 | 102 | } |
103 | 103 | catch (RequestException $e) { |
104 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
104 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
105 | 105 | } |
106 | 106 | |
107 | - if($response->{'ok'} === FALSE) { |
|
108 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
107 | + if ($response->{'ok'} === FALSE) { |
|
108 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | return $json_response->getBody(); |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | "reply_broadcast" => $reply_broadcast |
189 | 189 | ); |
190 | 190 | |
191 | - if($attachments != NULL) { |
|
191 | + if ($attachments != NULL) { |
|
192 | 192 | $arguments["attachments"] = $attachments; |
193 | 193 | } |
194 | - if($username != NULL) { |
|
194 | + if ($username != NULL) { |
|
195 | 195 | $arguments["username"] = $username; |
196 | 196 | } |
197 | - if($icon_url != NULL) { |
|
197 | + if ($icon_url != NULL) { |
|
198 | 198 | $arguments["icon_url"] = $icon_url; |
199 | 199 | } |
200 | - if($icon_emoji != NULL) { |
|
200 | + if ($icon_emoji != NULL) { |
|
201 | 201 | $arguments["icon_emoji"] = $icon_emoji; |
202 | 202 | } |
203 | - if($thread_ts != NULL) { |
|
204 | - $arguments["thread_ts"] = (string)$thread_ts; |
|
203 | + if ($thread_ts != NULL) { |
|
204 | + $arguments["thread_ts"] = (string) $thread_ts; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $this->setUrl("chat.postMessage", $arguments); |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | try { |
211 | 211 | $client = new \GuzzleHttp\Client(); |
212 | 212 | $json_response = $client->request('GET', $this->getUrl(), []); |
213 | - $response = json_decode( $json_response->getBody() ); |
|
213 | + $response = json_decode($json_response->getBody()); |
|
214 | 214 | } |
215 | 215 | catch (RequestException $e) { |
216 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
216 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
217 | 217 | } |
218 | 218 | |
219 | - if($response->{'ok'} === FALSE) { |
|
220 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
219 | + if ($response->{'ok'} === FALSE) { |
|
220 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return $json_response->getBody(); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | |
265 | 265 | // Set the arguments of the request |
266 | 266 | $arguments = array( |
267 | - "ts" => (string)$ts, |
|
267 | + "ts" => (string) $ts, |
|
268 | 268 | "channel" => $channel, |
269 | 269 | "text" => $text, |
270 | 270 | "parse" => $parse, |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | "as_user" => $as_user, |
273 | 273 | ); |
274 | 274 | |
275 | - if($attachments != NULL) { |
|
275 | + if ($attachments != NULL) { |
|
276 | 276 | $arguments["attachments"] = $attachments; |
277 | 277 | } |
278 | 278 | |
@@ -282,14 +282,14 @@ discard block |
||
282 | 282 | try { |
283 | 283 | $client = new \GuzzleHttp\Client(); |
284 | 284 | $json_response = $client->request('GET', $this->getUrl(), []); |
285 | - $response = json_decode( $json_response->getBody() ); |
|
285 | + $response = json_decode($json_response->getBody()); |
|
286 | 286 | } |
287 | 287 | catch (RequestException $e) { |
288 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
288 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
289 | 289 | } |
290 | 290 | |
291 | - if($response->{'ok'} === FALSE) { |
|
292 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
291 | + if ($response->{'ok'} === FALSE) { |
|
292 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | return $json_response->getBody(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | /** |
48 | 48 | * {@inheritdoc} |
49 | 49 | * |
50 | - * @return Dnd |
|
50 | + * @return \Psr\Http\Message\StreamInterface |
|
51 | 51 | */ |
52 | 52 | public function endSnooze() { |
53 | 53 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * {@inheritdoc} |
76 | 76 | * |
77 | 77 | * @param string $user |
78 | - * @return Dnd |
|
78 | + * @return \Psr\Http\Message\StreamInterface |
|
79 | 79 | */ |
80 | 80 | public function info($user = NULL) { |
81 | 81 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * {@inheritdoc} |
116 | 116 | * |
117 | 117 | * @param integer $num_minutes |
118 | - * @return Dnd |
|
118 | + * @return \Psr\Http\Message\StreamInterface |
|
119 | 119 | */ |
120 | 120 | public function setSnooze($num_minutes) { |
121 | 121 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * {@inheritdoc} |
154 | 154 | * |
155 | 155 | * @param string $users |
156 | - * @return Dnd |
|
156 | + * @return \Psr\Http\Message\StreamInterface |
|
157 | 157 | */ |
158 | 158 | public function teamInfo($users = NULL) { |
159 | 159 |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | try { |
31 | 31 | $client = new \GuzzleHttp\Client(); |
32 | 32 | $json_response = $client->request('GET', $this->getUrl(), []); |
33 | - $response = json_decode( $json_response->getBody() ); |
|
33 | + $response = json_decode($json_response->getBody()); |
|
34 | 34 | } |
35 | 35 | catch (RequestException $e) { |
36 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
36 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
37 | 37 | } |
38 | 38 | |
39 | - if($response->{'ok'} === FALSE) { |
|
40 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
39 | + if ($response->{'ok'} === FALSE) { |
|
40 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | return $this; |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | try { |
58 | 58 | $client = new \GuzzleHttp\Client(); |
59 | 59 | $json_response = $client->request('GET', $this->getUrl(), []); |
60 | - $response = json_decode( $json_response->getBody() ); |
|
60 | + $response = json_decode($json_response->getBody()); |
|
61 | 61 | } |
62 | 62 | catch (RequestException $e) { |
63 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
63 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
64 | 64 | } |
65 | 65 | |
66 | - if($response->{'ok'} === FALSE) { |
|
67 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
66 | + if ($response->{'ok'} === FALSE) { |
|
67 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | return $json_response->getBody(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | // Set the arguments of the request |
88 | 88 | $arguments = array(); |
89 | 89 | |
90 | - if($user != NULL) { |
|
90 | + if ($user != NULL) { |
|
91 | 91 | $arguments["user"] = $user; |
92 | 92 | } |
93 | 93 | |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | try { |
98 | 98 | $client = new \GuzzleHttp\Client(); |
99 | 99 | $json_response = $client->request('GET', $this->getUrl(), []); |
100 | - $response = json_decode( $json_response->getBody() ); |
|
100 | + $response = json_decode($json_response->getBody()); |
|
101 | 101 | } |
102 | 102 | catch (RequestException $e) { |
103 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
103 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
104 | 104 | } |
105 | 105 | |
106 | - if($response->{'ok'} === FALSE) { |
|
107 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
106 | + if ($response->{'ok'} === FALSE) { |
|
107 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $json_response->getBody(); |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | try { |
136 | 136 | $client = new \GuzzleHttp\Client(); |
137 | 137 | $json_response = $client->request('GET', $this->getUrl(), []); |
138 | - $response = json_decode( $json_response->getBody() ); |
|
138 | + $response = json_decode($json_response->getBody()); |
|
139 | 139 | } |
140 | 140 | catch (RequestException $e) { |
141 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
141 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
142 | 142 | } |
143 | 143 | |
144 | - if($response->{'ok'} === FALSE) { |
|
145 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
144 | + if ($response->{'ok'} === FALSE) { |
|
145 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return $json_response->getBody(); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // Set the arguments of the request |
166 | 166 | $arguments = array(); |
167 | 167 | |
168 | - if($user != NULL) { |
|
168 | + if ($user != NULL) { |
|
169 | 169 | $arguments["users"] = $users; |
170 | 170 | } |
171 | 171 | |
@@ -175,14 +175,14 @@ discard block |
||
175 | 175 | try { |
176 | 176 | $client = new \GuzzleHttp\Client(); |
177 | 177 | $json_response = $client->request('GET', $this->getUrl(), []); |
178 | - $response = json_decode( $json_response->getBody() ); |
|
178 | + $response = json_decode($json_response->getBody()); |
|
179 | 179 | } |
180 | 180 | catch (RequestException $e) { |
181 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
181 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
182 | 182 | } |
183 | 183 | |
184 | - if($response->{'ok'} === FALSE) { |
|
185 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
184 | + if ($response->{'ok'} === FALSE) { |
|
185 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | return $json_response->getBody(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string $file |
24 | 24 | * @param string $comment |
25 | 25 | * @param string $channel |
26 | - * @return FilesComments |
|
26 | + * @return \Psr\Http\Message\StreamInterface |
|
27 | 27 | */ |
28 | 28 | public function add($file, $comment, $channel = NULL) { |
29 | 29 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @param string $file |
118 | 118 | * @param string $id |
119 | 119 | * @param string $comment |
120 | - * @return FilesComments |
|
120 | + * @return \Psr\Http\Message\StreamInterface |
|
121 | 121 | */ |
122 | 122 | public function edit($file, $id, $comment) { |
123 | 123 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | "comment" => $comment |
45 | 45 | ); |
46 | 46 | |
47 | - if($channel != NULL) { |
|
47 | + if ($channel != NULL) { |
|
48 | 48 | $arguments["channel"] = $channel; |
49 | 49 | } |
50 | 50 | |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | try { |
55 | 55 | $client = new \GuzzleHttp\Client(); |
56 | 56 | $json_response = $client->request('GET', $this->getUrl(), []); |
57 | - $response = json_decode( $json_response->getBody() ); |
|
57 | + $response = json_decode($json_response->getBody()); |
|
58 | 58 | } |
59 | 59 | catch (RequestException $e) { |
60 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
60 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
61 | 61 | } |
62 | 62 | |
63 | - if($response->{'ok'} === FALSE) { |
|
64 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
63 | + if ($response->{'ok'} === FALSE) { |
|
64 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $json_response->getBody(); |
@@ -97,14 +97,14 @@ discard block |
||
97 | 97 | try { |
98 | 98 | $client = new \GuzzleHttp\Client(); |
99 | 99 | $json_response = $client->request('GET', $this->getUrl(), []); |
100 | - $response = json_decode( $json_response->getBody() ); |
|
100 | + $response = json_decode($json_response->getBody()); |
|
101 | 101 | } |
102 | 102 | catch (RequestException $e) { |
103 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
103 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
104 | 104 | } |
105 | 105 | |
106 | - if($response->{'ok'} === FALSE) { |
|
107 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
106 | + if ($response->{'ok'} === FALSE) { |
|
107 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | return $this; |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | try { |
146 | 146 | $client = new \GuzzleHttp\Client(); |
147 | 147 | $json_response = $client->request('GET', $this->getUrl(), []); |
148 | - $response = json_decode( $json_response->getBody() ); |
|
148 | + $response = json_decode($json_response->getBody()); |
|
149 | 149 | } |
150 | 150 | catch (RequestException $e) { |
151 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
151 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
152 | 152 | } |
153 | 153 | |
154 | - if($response->{'ok'} === FALSE) { |
|
155 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
154 | + if ($response->{'ok'} === FALSE) { |
|
155 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $json_response->getBody(); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param string $client_secret |
25 | 25 | * @param string $code |
26 | 26 | * @param string $redirect_uri |
27 | - * @return string $response |
|
27 | + * @return \Psr\Http\Message\StreamInterface $response |
|
28 | 28 | */ |
29 | 29 | public function access($client_id, $client_secret, $code, $redirect_uri = NULL) { |
30 | 30 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | "code" => $code |
50 | 50 | ); |
51 | 51 | |
52 | - if($redirect_uri != NULL) { |
|
52 | + if ($redirect_uri != NULL) { |
|
53 | 53 | $arguments["redirect_uri"] = $redirect_uri; |
54 | 54 | } |
55 | 55 | |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | try { |
60 | 60 | $client = new \GuzzleHttp\Client(); |
61 | 61 | $json_response = $client->request('GET', $this->getUrl(), []); |
62 | - $response = json_decode( $json_response->getBody() ); |
|
62 | + $response = json_decode($json_response->getBody()); |
|
63 | 63 | } |
64 | 64 | catch (RequestException $e) { |
65 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
65 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
66 | 66 | } |
67 | 67 | |
68 | - if($response->{'ok'} === FALSE) { |
|
69 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
68 | + if ($response->{'ok'} === FALSE) { |
|
69 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return $json_response->getBody(); |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * {@inheritdoc} |
22 | 22 | * |
23 | - * @param string $count |
|
24 | - * @param string $page |
|
23 | + * @param integer $count |
|
24 | + * @param integer $page |
|
25 | 25 | * @param string $before |
26 | - * @return string |
|
26 | + * @return \Psr\Http\Message\StreamInterface |
|
27 | 27 | */ |
28 | 28 | public function accessLogs($count = 100, $page = 1, $before = NULL) { |
29 | 29 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * {@inheritdoc} |
75 | 75 | * |
76 | 76 | * @param string $user |
77 | - * @return string |
|
77 | + * @return \Psr\Http\Message\StreamInterface |
|
78 | 78 | */ |
79 | 79 | public function billableInfo($user = NULL) { |
80 | 80 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * {@inheritdoc} |
117 | 117 | * |
118 | - * @return string |
|
118 | + * @return \Psr\Http\Message\StreamInterface |
|
119 | 119 | */ |
120 | 120 | public function info() { |
121 | 121 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param string $change_type |
152 | 152 | * @param int $count |
153 | 153 | * @param int $page |
154 | - * @return string |
|
154 | + * @return \Psr\Http\Message\StreamInterface |
|
155 | 155 | */ |
156 | 156 | public function integrationLogs($service_id = NULL, $app_id = NULL, $user = NULL, $change_type = NULL, $count = 100, $page = 1) { |
157 | 157 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * {@inheritdoc} |
224 | 224 | * |
225 | 225 | * @param string $visibility |
226 | - * @return string |
|
226 | + * @return \Psr\Http\Message\StreamInterface |
|
227 | 227 | */ |
228 | 228 | public function profileGet($visibility = NULL) { |
229 | 229 |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | try { |
55 | 55 | $client = new \GuzzleHttp\Client(); |
56 | 56 | $json_response = $client->request('GET', $this->getUrl(), []); |
57 | - $response = json_decode( $json_response->getBody() ); |
|
57 | + $response = json_decode($json_response->getBody()); |
|
58 | 58 | } |
59 | 59 | catch (RequestException $e) { |
60 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
60 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
61 | 61 | } |
62 | 62 | |
63 | - if($response->{'ok'} === FALSE) { |
|
64 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
63 | + if ($response->{'ok'} === FALSE) { |
|
64 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | return $json_response->getBody(); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // Set the arguments of the request |
87 | 87 | $arguments = array(); |
88 | 88 | |
89 | - if($user != NULL) { |
|
89 | + if ($user != NULL) { |
|
90 | 90 | $arguments["user"] = $user; |
91 | 91 | } |
92 | 92 | |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | try { |
97 | 97 | $client = new \GuzzleHttp\Client(); |
98 | 98 | $json_response = $client->request('GET', $this->getUrl(), []); |
99 | - $response = json_decode( $json_response->getBody() ); |
|
99 | + $response = json_decode($json_response->getBody()); |
|
100 | 100 | } |
101 | 101 | catch (RequestException $e) { |
102 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
102 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
103 | 103 | } |
104 | 104 | |
105 | - if($response->{'ok'} === FALSE) { |
|
106 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
105 | + if ($response->{'ok'} === FALSE) { |
|
106 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | return $json_response->getBody(); |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | try { |
126 | 126 | $client = new \GuzzleHttp\Client(); |
127 | 127 | $json_response = $client->request('GET', $this->getUrl(), []); |
128 | - $response = json_decode( $json_response->getBody() ); |
|
128 | + $response = json_decode($json_response->getBody()); |
|
129 | 129 | } |
130 | 130 | catch (RequestException $e) { |
131 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
131 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
132 | 132 | } |
133 | 133 | |
134 | - if($response->{'ok'} === FALSE) { |
|
135 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
134 | + if ($response->{'ok'} === FALSE) { |
|
135 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return $json_response->getBody(); |
@@ -178,22 +178,22 @@ discard block |
||
178 | 178 | // Set the arguments of the request |
179 | 179 | $arguments = array(); |
180 | 180 | |
181 | - if($service_id != NULL) { |
|
181 | + if ($service_id != NULL) { |
|
182 | 182 | $arguments["service_id"] = $service_id; |
183 | 183 | } |
184 | - if($app_id != NULL) { |
|
184 | + if ($app_id != NULL) { |
|
185 | 185 | $arguments["app_id"] = $app_id; |
186 | 186 | } |
187 | - if($user != NULL) { |
|
187 | + if ($user != NULL) { |
|
188 | 188 | $arguments["user"] = $user; |
189 | 189 | } |
190 | - if($change_type != NULL) { |
|
190 | + if ($change_type != NULL) { |
|
191 | 191 | $arguments["change_type"] = $change_type; |
192 | 192 | } |
193 | - if($count != NULL) { |
|
193 | + if ($count != NULL) { |
|
194 | 194 | $arguments["count"] = $count; |
195 | 195 | } |
196 | - if($page != NULL) { |
|
196 | + if ($page != NULL) { |
|
197 | 197 | $arguments["page"] = $page; |
198 | 198 | } |
199 | 199 | |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | try { |
204 | 204 | $client = new \GuzzleHttp\Client(); |
205 | 205 | $json_response = $client->request('GET', $this->getUrl(), []); |
206 | - $response = json_decode( $json_response->getBody() ); |
|
206 | + $response = json_decode($json_response->getBody()); |
|
207 | 207 | } |
208 | 208 | catch (RequestException $e) { |
209 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
209 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
210 | 210 | } |
211 | 211 | |
212 | - if($response->{'ok'} === FALSE) { |
|
213 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
212 | + if ($response->{'ok'} === FALSE) { |
|
213 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | return $json_response->getBody(); |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | try { |
249 | 249 | $client = new \GuzzleHttp\Client(); |
250 | 250 | $json_response = $client->request('GET', $this->getUrl(), []); |
251 | - $response = json_decode( $json_response->getBody() ); |
|
251 | + $response = json_decode($json_response->getBody()); |
|
252 | 252 | } |
253 | 253 | catch (RequestException $e) { |
254 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
254 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
255 | 255 | } |
256 | 256 | |
257 | - if($response->{'ok'} === FALSE) { |
|
258 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
257 | + if ($response->{'ok'} === FALSE) { |
|
258 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $json_response->getBody(); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @param string $user |
24 | 24 | * @param bool $include_labels |
25 | - * @return string |
|
25 | + * @return \Psr\Http\Message\StreamInterface |
|
26 | 26 | */ |
27 | 27 | public function get($user = NULL, $include_labels = NULL) { |
28 | 28 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @param string $profile |
74 | 74 | * @param string $name |
75 | 75 | * @param string $value |
76 | - * @return string |
|
76 | + * @return \Psr\Http\Message\StreamInterface |
|
77 | 77 | */ |
78 | 78 | public function set($user = NULL, $profile = NULL, $name = NULL, $value = NULL) { |
79 | 79 |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | try { |
51 | 51 | $client = new \GuzzleHttp\Client(); |
52 | 52 | $json_response = $client->request('GET', $this->getUrl(), []); |
53 | - $response = json_decode( $json_response->getBody() ); |
|
53 | + $response = json_decode($json_response->getBody()); |
|
54 | 54 | } |
55 | 55 | catch (RequestException $e) { |
56 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
56 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
57 | 57 | } |
58 | 58 | |
59 | - if($response->{'ok'} === FALSE) { |
|
60 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
59 | + if ($response->{'ok'} === FALSE) { |
|
60 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | return $json_response->getBody(); |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | try { |
114 | 114 | $client = new \GuzzleHttp\Client(); |
115 | 115 | $json_response = $client->request('GET', $this->getUrl(), []); |
116 | - $response = json_decode( $json_response->getBody() ); |
|
116 | + $response = json_decode($json_response->getBody()); |
|
117 | 117 | } |
118 | 118 | catch (RequestException $e) { |
119 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
119 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
120 | 120 | } |
121 | 121 | |
122 | - if($response->{'ok'} === FALSE) { |
|
123 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
122 | + if ($response->{'ok'} === FALSE) { |
|
123 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $json_response->getBody(); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | try { |
42 | 42 | $client = new \GuzzleHttp\Client(); |
43 | 43 | $json_response = $client->request('GET', $this->getUrl(), []); |
44 | - $response = json_decode( $json_response->getBody() ); |
|
44 | + $response = json_decode($json_response->getBody()); |
|
45 | 45 | } |
46 | 46 | catch (RequestException $e) { |
47 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
47 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
48 | 48 | } |
49 | 49 | |
50 | - if($response->{'ok'} === FALSE) { |
|
51 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
50 | + if ($response->{'ok'} === FALSE) { |
|
51 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return $this; |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | try { |
91 | 91 | $client = new \GuzzleHttp\Client(); |
92 | 92 | $json_response = $client->request('GET', $this->getUrl(), []); |
93 | - $response = json_decode( $json_response->getBody() ); |
|
93 | + $response = json_decode($json_response->getBody()); |
|
94 | 94 | } |
95 | 95 | catch (RequestException $e) { |
96 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
96 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
97 | 97 | } |
98 | 98 | |
99 | - if($response->{'ok'} === FALSE) { |
|
100 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
99 | + if ($response->{'ok'} === FALSE) { |
|
100 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $json_response->getBody(); |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | |
145 | 145 | // Set the arguments of the request |
146 | 146 | $arguments = array( |
147 | - "ts_from" => (string)$ts_from, |
|
148 | - "ts_to" => (string)$ts_to, |
|
147 | + "ts_from" => (string) $ts_from, |
|
148 | + "ts_to" => (string) $ts_to, |
|
149 | 149 | "types" => $types, |
150 | 150 | "count" => $count, |
151 | 151 | "page" => $page |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $client = new \GuzzleHttp\Client(); |
166 | 166 | $json_response = $client->request('GET', $this->getUrl(), []); |
167 | - $response = json_decode( $json_response->getBody() ); |
|
167 | + $response = json_decode($json_response->getBody()); |
|
168 | 168 | } |
169 | 169 | catch (RequestException $e) { |
170 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
170 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
171 | 171 | } |
172 | 172 | |
173 | - if($response->{'ok'} === FALSE) { |
|
174 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
173 | + if ($response->{'ok'} === FALSE) { |
|
174 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $json_response->getBody(); |
@@ -203,14 +203,14 @@ discard block |
||
203 | 203 | try { |
204 | 204 | $client = new \GuzzleHttp\Client(); |
205 | 205 | $json_response = $client->request('GET', $this->getUrl(), []); |
206 | - $response = json_decode( $json_response->getBody() ); |
|
206 | + $response = json_decode($json_response->getBody()); |
|
207 | 207 | } |
208 | 208 | catch (RequestException $e) { |
209 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
209 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
210 | 210 | } |
211 | 211 | |
212 | - if($response->{'ok'} === FALSE) { |
|
213 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
212 | + if ($response->{'ok'} === FALSE) { |
|
213 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | return $this; |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | try { |
243 | 243 | $client = new \GuzzleHttp\Client(); |
244 | 244 | $json_response = $client->request('GET', $this->getUrl(), []); |
245 | - $response = json_decode( $json_response->getBody() ); |
|
245 | + $response = json_decode($json_response->getBody()); |
|
246 | 246 | } |
247 | 247 | catch (RequestException $e) { |
248 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
248 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
249 | 249 | } |
250 | 250 | |
251 | - if($response->{'ok'} === FALSE) { |
|
252 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
251 | + if ($response->{'ok'} === FALSE) { |
|
252 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | return $json_response->getBody(); |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | // Get the content of the file |
295 | - if(file_exists( $path_to_file )) { |
|
296 | - $content = file_get_contents( $path_to_file ); |
|
295 | + if (file_exists($path_to_file)) { |
|
296 | + $content = file_get_contents($path_to_file); |
|
297 | 297 | } |
298 | 298 | else { |
299 | 299 | throw new RuntimeException("The path to the file is not valid."); |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | 'http_errors' => false, |
323 | 323 | 'json' => $post_content |
324 | 324 | ]); |
325 | - $response = json_decode( $json_response->getBody() ); |
|
325 | + $response = json_decode($json_response->getBody()); |
|
326 | 326 | } |
327 | 327 | catch (RequestException $e) { |
328 | - throw new RuntimeException('The request to the API failed: '.$e->getMessage(), $e->getCode(), $e); |
|
328 | + throw new RuntimeException('The request to the API failed: ' . $e->getMessage(), $e->getCode(), $e); |
|
329 | 329 | } |
330 | 330 | |
331 | - if($response->{'ok'} === FALSE) { |
|
332 | - throw new RuntimeException('The request to the API failed: '.$response->{'error'}."."); |
|
331 | + if ($response->{'ok'} === FALSE) { |
|
332 | + throw new RuntimeException('The request to the API failed: ' . $response->{'error'} . "."); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | return $this; |
@@ -319,7 +319,7 @@ |
||
319 | 319 | $client = new \GuzzleHttp\Client(); |
320 | 320 | $json_response = $client->request('POST', $this->getUrl(), [ |
321 | 321 | 'headers' => $headers, |
322 | - 'http_errors' => false, |
|
322 | + 'http_errors' => FALSE, |
|
323 | 323 | 'json' => $post_content |
324 | 324 | ]); |
325 | 325 | $response = json_decode( $json_response->getBody() ); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param string $file |
63 | 63 | * @param integer $count |
64 | 64 | * @param integer $page |
65 | - * @return Files |
|
65 | + * @return \Psr\Http\Message\StreamInterface |
|
66 | 66 | */ |
67 | 67 | public function info($file, $count = 100, $page = 1) { |
68 | 68 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param string $types |
116 | 116 | * @param integer $count |
117 | 117 | * @param integer $page |
118 | - * @return Files |
|
118 | + * @return \Psr\Http\Message\StreamInterface |
|
119 | 119 | */ |
120 | 120 | public function list_files($user = NULL, $channel = NULL, $ts_from = "now", $ts_to = "all", $types = "all", $count = 100, $page = 1) { |
121 | 121 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * {@inheritdoc} |
223 | 223 | * |
224 | 224 | * @param string $file |
225 | - * @return Files |
|
225 | + * @return \Psr\Http\Message\StreamInterface |
|
226 | 226 | */ |
227 | 227 | public function sharedPublicURL($file) { |
228 | 228 |