@@ -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 | } |
@@ -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 | } |
@@ -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 | } |