@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | /** |
260 | 260 | * Set the color to use for the attachment |
261 | 261 | * |
262 | - * @param string $colour |
|
263 | - * @return void |
|
262 | + * @param string $color |
|
263 | + * @return Attachment |
|
264 | 264 | */ |
265 | 265 | public function setColor($color) |
266 | 266 | { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * Set the title to use for the attachment |
284 | 284 | * |
285 | 285 | * @param string $title |
286 | - * @return void |
|
286 | + * @return Attachment |
|
287 | 287 | */ |
288 | 288 | public function setTitle($title) |
289 | 289 | { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * Set the title link to use for the attachment |
307 | 307 | * |
308 | 308 | * @param string $title_link |
309 | - * @return void |
|
309 | + * @return Attachment |
|
310 | 310 | */ |
311 | 311 | public function setTitleLink($title_link) |
312 | 312 | { |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * Set the author name to use for the attachment |
330 | 330 | * |
331 | 331 | * @param string $author_name |
332 | - * @return void |
|
332 | + * @return Attachment |
|
333 | 333 | */ |
334 | 334 | public function setAuthorName($author_name) |
335 | 335 | { |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * Set the auhtor link to use for the attachment |
353 | 353 | * |
354 | 354 | * @param string $author_link |
355 | - * @return void |
|
355 | + * @return Attachment |
|
356 | 356 | */ |
357 | 357 | public function setAuthorLink($author_link) |
358 | 358 | { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * Set the author icon to use for the attachment |
376 | 376 | * |
377 | 377 | * @param string $author_icon |
378 | - * @return void |
|
378 | + * @return Attachment |
|
379 | 379 | */ |
380 | 380 | public function setAuthorIcon($author_icon) |
381 | 381 | { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * Set the fields for the attachment |
398 | 398 | * |
399 | 399 | * @param array $fields |
400 | - * @return void |
|
400 | + * @return Attachment |
|
401 | 401 | */ |
402 | 402 | public function setFields(array $fields) |
403 | 403 | { |
@@ -26,10 +26,10 @@ |
||
26 | 26 | protected $image_url; |
27 | 27 | |
28 | 28 | /** |
29 | - * Optional thumbnail that should appear within the attachment |
|
30 | - * |
|
31 | - * @var string |
|
32 | - */ |
|
29 | + * Optional thumbnail that should appear within the attachment |
|
30 | + * |
|
31 | + * @var string |
|
32 | + */ |
|
33 | 33 | protected $thumb_url; |
34 | 34 | |
35 | 35 | /** |
@@ -104,31 +104,57 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function __construct(array $attributes) |
106 | 106 | { |
107 | - if (isset($attributes['fallback'])) $this->setFallback($attributes['fallback']); |
|
107 | + if (isset($attributes['fallback'])) { |
|
108 | + $this->setFallback($attributes['fallback']); |
|
109 | + } |
|
108 | 110 | |
109 | - if (isset($attributes['text'])) $this->setText($attributes['text']); |
|
111 | + if (isset($attributes['text'])) { |
|
112 | + $this->setText($attributes['text']); |
|
113 | + } |
|
110 | 114 | |
111 | - if (isset($attributes['image_url'])) $this->setImageUrl($attributes['image_url']); |
|
115 | + if (isset($attributes['image_url'])) { |
|
116 | + $this->setImageUrl($attributes['image_url']); |
|
117 | + } |
|
112 | 118 | |
113 | - if (isset($attributes['thumb_url'])) $this->setThumbUrl($attributes['thumb_url']); |
|
119 | + if (isset($attributes['thumb_url'])) { |
|
120 | + $this->setThumbUrl($attributes['thumb_url']); |
|
121 | + } |
|
114 | 122 | |
115 | - if (isset($attributes['pretext'])) $this->setPretext($attributes['pretext']); |
|
123 | + if (isset($attributes['pretext'])) { |
|
124 | + $this->setPretext($attributes['pretext']); |
|
125 | + } |
|
116 | 126 | |
117 | - if (isset($attributes['color'])) $this->setColor($attributes['color']); |
|
127 | + if (isset($attributes['color'])) { |
|
128 | + $this->setColor($attributes['color']); |
|
129 | + } |
|
118 | 130 | |
119 | - if (isset($attributes['fields'])) $this->setFields($attributes['fields']); |
|
131 | + if (isset($attributes['fields'])) { |
|
132 | + $this->setFields($attributes['fields']); |
|
133 | + } |
|
120 | 134 | |
121 | - if (isset($attributes['mrkdwn_in'])) $this->setMarkdownFields($attributes['mrkdwn_in']); |
|
135 | + if (isset($attributes['mrkdwn_in'])) { |
|
136 | + $this->setMarkdownFields($attributes['mrkdwn_in']); |
|
137 | + } |
|
122 | 138 | |
123 | - if (isset($attributes['title'])) $this->setTitle($attributes['title']); |
|
139 | + if (isset($attributes['title'])) { |
|
140 | + $this->setTitle($attributes['title']); |
|
141 | + } |
|
124 | 142 | |
125 | - if (isset($attributes['title_link'])) $this->setTitleLink($attributes['title_link']); |
|
143 | + if (isset($attributes['title_link'])) { |
|
144 | + $this->setTitleLink($attributes['title_link']); |
|
145 | + } |
|
126 | 146 | |
127 | - if (isset($attributes['author_name'])) $this->setAuthorName($attributes['author_name']); |
|
147 | + if (isset($attributes['author_name'])) { |
|
148 | + $this->setAuthorName($attributes['author_name']); |
|
149 | + } |
|
128 | 150 | |
129 | - if (isset($attributes['author_link'])) $this->setAuthorLink($attributes['author_link']); |
|
151 | + if (isset($attributes['author_link'])) { |
|
152 | + $this->setAuthorLink($attributes['author_link']); |
|
153 | + } |
|
130 | 154 | |
131 | - if (isset($attributes['author_icon'])) $this->setAuthorIcon($attributes['author_icon']); |
|
155 | + if (isset($attributes['author_icon'])) { |
|
156 | + $this->setAuthorIcon($attributes['author_icon']); |
|
157 | + } |
|
132 | 158 | } |
133 | 159 | |
134 | 160 | /** |
@@ -424,9 +450,7 @@ discard block |
||
424 | 450 | $this->fields[] = $field; |
425 | 451 | |
426 | 452 | return $this; |
427 | - } |
|
428 | - |
|
429 | - elseif (is_array($field)) |
|
453 | + } elseif (is_array($field)) |
|
430 | 454 | { |
431 | 455 | $this->fields[] = new AttachmentField($field); |
432 | 456 | |
@@ -510,7 +534,9 @@ discard block |
||
510 | 534 | { |
511 | 535 | $fields = []; |
512 | 536 | |
513 | - foreach ($this->getFields() as $field) $fields[] = $field->toArray(); |
|
537 | + foreach ($this->getFields() as $field) { |
|
538 | + $fields[] = $field->toArray(); |
|
539 | + } |
|
514 | 540 | |
515 | 541 | return $fields; |
516 | 542 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * Set the icon (either URL or emoji) we will post as. |
177 | 177 | * |
178 | 178 | * @param string $icon |
179 | - * @return this |
|
179 | + * @return null|Message |
|
180 | 180 | */ |
181 | 181 | public function setIcon($icon) |
182 | 182 | { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * Slack's Markdown-like language |
229 | 229 | * |
230 | 230 | * @param boolean $value |
231 | - * @return void |
|
231 | + * @return Message |
|
232 | 232 | */ |
233 | 233 | public function setAllowMarkdown($value) |
234 | 234 | { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * Enable Markdown formatting for the message |
242 | 242 | * |
243 | - * @return void |
|
243 | + * @return Message |
|
244 | 244 | */ |
245 | 245 | public function enableMarkdown() |
246 | 246 | { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | /** |
253 | 253 | * Disable Markdown formatting for the message |
254 | 254 | * |
255 | - * @return void |
|
255 | + * @return Message |
|
256 | 256 | */ |
257 | 257 | public function disableMarkdown() |
258 | 258 | { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * in Slack's Markdown-like language |
278 | 278 | * |
279 | 279 | * @param array $fields |
280 | - * @return void |
|
280 | + * @return Message |
|
281 | 281 | */ |
282 | 282 | public function setMarkdownInAttachments(array $fields) |
283 | 283 | { |
@@ -190,9 +190,7 @@ discard block |
||
190 | 190 | if (mb_substr($icon, 0, 1) == ":" && mb_substr($icon, mb_strlen($icon) - 1, 1) == ":") |
191 | 191 | { |
192 | 192 | $this->iconType = self::ICON_TYPE_EMOJI; |
193 | - } |
|
194 | - |
|
195 | - else |
|
193 | + } else |
|
196 | 194 | { |
197 | 195 | $this->iconType = self::ICON_TYPE_URL; |
198 | 196 | } |
@@ -338,9 +336,7 @@ discard block |
||
338 | 336 | $this->attachments[] = $attachment; |
339 | 337 | |
340 | 338 | return $this; |
341 | - } |
|
342 | - |
|
343 | - elseif (is_array($attachment)) |
|
339 | + } elseif (is_array($attachment)) |
|
344 | 340 | { |
345 | 341 | $attachmentObject = new Attachment($attachment); |
346 | 342 | |
@@ -405,7 +401,9 @@ discard block |
||
405 | 401 | */ |
406 | 402 | public function send($text = null) |
407 | 403 | { |
408 | - if ($text) $this->setText($text); |
|
404 | + if ($text) { |
|
405 | + $this->setText($text); |
|
406 | + } |
|
409 | 407 | |
410 | 408 | $this->client->sendMessage($this); |
411 | 409 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Return the service provider for the particular Laravel version |
57 | 57 | * |
58 | - * @return mixed |
|
58 | + * @return SlackServiceProviderLaravel4 |
|
59 | 59 | */ |
60 | 60 | private function getProvider() |
61 | 61 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * Get the services provided by the provider. |
81 | 81 | * |
82 | - * @return array |
|
82 | + * @return string[] |
|
83 | 83 | */ |
84 | 84 | public function provides() |
85 | 85 | { |
@@ -77,10 +77,10 @@ |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
80 | - * Get the services provided by the provider. |
|
81 | - * |
|
82 | - * @return array |
|
83 | - */ |
|
80 | + * Get the services provided by the provider. |
|
81 | + * |
|
82 | + * @return array |
|
83 | + */ |
|
84 | 84 | public function provides() |
85 | 85 | { |
86 | 86 | return ['maknz.slack']; |
@@ -32,11 +32,17 @@ |
||
32 | 32 | */ |
33 | 33 | public function __construct(array $attributes) |
34 | 34 | { |
35 | - if (isset($attributes['title'])) $this->setTitle($attributes['title']); |
|
35 | + if (isset($attributes['title'])) { |
|
36 | + $this->setTitle($attributes['title']); |
|
37 | + } |
|
36 | 38 | |
37 | - if (isset($attributes['value'])) $this->setValue($attributes['value']); |
|
39 | + if (isset($attributes['value'])) { |
|
40 | + $this->setValue($attributes['value']); |
|
41 | + } |
|
38 | 42 | |
39 | - if (isset($attributes['short'])) $this->setShort($attributes['short']); |
|
43 | + if (isset($attributes['short'])) { |
|
44 | + $this->setShort($attributes['short']); |
|
45 | + } |
|
40 | 46 | } |
41 | 47 | |
42 | 48 | /** |
@@ -89,21 +89,37 @@ |
||
89 | 89 | { |
90 | 90 | $this->endpoint = $endpoint; |
91 | 91 | |
92 | - if (isset($attributes['channel'])) $this->setDefaultChannel($attributes['channel']); |
|
92 | + if (isset($attributes['channel'])) { |
|
93 | + $this->setDefaultChannel($attributes['channel']); |
|
94 | + } |
|
93 | 95 | |
94 | - if (isset($attributes['username'])) $this->setDefaultUsername($attributes['username']); |
|
96 | + if (isset($attributes['username'])) { |
|
97 | + $this->setDefaultUsername($attributes['username']); |
|
98 | + } |
|
95 | 99 | |
96 | - if (isset($attributes['icon'])) $this->setDefaultIcon($attributes['icon']); |
|
100 | + if (isset($attributes['icon'])) { |
|
101 | + $this->setDefaultIcon($attributes['icon']); |
|
102 | + } |
|
97 | 103 | |
98 | - if (isset($attributes['link_names'])) $this->setLinkNames($attributes['link_names']); |
|
104 | + if (isset($attributes['link_names'])) { |
|
105 | + $this->setLinkNames($attributes['link_names']); |
|
106 | + } |
|
99 | 107 | |
100 | - if (isset($attributes['unfurl_links'])) $this->setUnfurlLinks($attributes['unfurl_links']); |
|
108 | + if (isset($attributes['unfurl_links'])) { |
|
109 | + $this->setUnfurlLinks($attributes['unfurl_links']); |
|
110 | + } |
|
101 | 111 | |
102 | - if (isset($attributes['unfurl_media'])) $this->setUnfurlMedia($attributes['unfurl_media']); |
|
112 | + if (isset($attributes['unfurl_media'])) { |
|
113 | + $this->setUnfurlMedia($attributes['unfurl_media']); |
|
114 | + } |
|
103 | 115 | |
104 | - if (isset($attributes['allow_markdown'])) $this->setAllowMarkdown($attributes['allow_markdown']); |
|
116 | + if (isset($attributes['allow_markdown'])) { |
|
117 | + $this->setAllowMarkdown($attributes['allow_markdown']); |
|
118 | + } |
|
105 | 119 | |
106 | - if (isset($attributes['markdown_in_attachments'])) $this->setMarkdownInAttachments($attributes['markdown_in_attachments']); |
|
120 | + if (isset($attributes['markdown_in_attachments'])) { |
|
121 | + $this->setMarkdownInAttachments($attributes['markdown_in_attachments']); |
|
122 | + } |
|
107 | 123 | |
108 | 124 | $this->guzzle = $guzzle ?: new Guzzle; |
109 | 125 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function boot() |
14 | 14 | { |
15 | - $this->publishes([__DIR__ . '/config/config.php' => config_path('slack.php')]); |
|
15 | + $this->publishes([__DIR__.'/config/config.php' => config_path('slack.php')]); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function register() |
24 | 24 | { |
25 | - $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'slack'); |
|
25 | + $this->mergeConfigFrom(__DIR__.'/config/config.php', 'slack'); |
|
26 | 26 | |
27 | 27 | $this->app['maknz.slack'] = $this->app->share(function($app) |
28 | 28 | { |