| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * This file is part of the WoW-Apps/Symfony-Slack-Bot bundle for Symfony. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * https://github.com/wow-apps/symfony-slack-bot | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * https://github.com/wow-apps/symfony-slack-bot/blob/master/LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * For technical documentation. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * https://wow-apps.github.io/symfony-slack-bot/docs/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * Author Alexey Samara <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * Copyright 2016 WoW-Apps. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | namespace WowApps\SlackBundle\DTO; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @author Alexey Samara <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | class SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     /** @var string */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     private $username; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     /** @var string */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     private $channel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     /** @var string */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |     private $iconUrl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     /** @var string */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     private $iconEmoji; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     /** @var bool */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     private $markdown; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     /** @var string */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     private $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     /** @var Attachment[] */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     private $attachments; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      * SlackMessage constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * @param string $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @param string $username | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @param string $channel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      * @param string $iconUrl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      * @param string $iconEmoji | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      * @param bool   $markdown | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * @param array  $attachments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         string $text = '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |         string $username = '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         string $channel = '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         string $iconUrl = '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         string $iconEmoji = '', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         bool   $markdown = true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         array  $attachments = [] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         $this->text = $text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $this->username = $username; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         $this->channel = $channel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $this->iconUrl = $iconUrl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         $this->iconEmoji = $iconEmoji; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         $this->markdown = $markdown; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |         $this->attachments = $attachments; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 | 24 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * Returns the user name on behalf of which the message will be sent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     public function getUsername(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         return $this->username; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 | 24 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 | 24 |  |      * Set the user name on behalf of which the message will be sent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 | 24 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 | 24 |  |      * @param string $username | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 | 24 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 | 24 |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 | 24 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 | 24 |  |     public function setUsername(string $username): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 | 24 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |         $this->username = $username; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 | 24 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      * Returns the name of channel where the message will be sent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 | 1 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     public function getChannel(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 | 1 |  |         return $this->channel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 | 1 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |      * Set the name of channel where the message will be sent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      * @param string $channel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     public function setChannel(string $channel): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         $this->channel = $channel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 | 24 |  |      * Returns icon url of message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 | 24 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     public function getIconUrl(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         return $this->iconUrl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 | 24 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 | 24 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * Set the icon url for a message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      * @param string $iconUrl | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 | 4 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     public function setIconUrl(string $iconUrl): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 | 4 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         $this->iconUrl = $iconUrl; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 | 24 |  |      * Returns icon Emoji of message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 | 24 |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 | 24 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     public function getIconEmoji(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         return $this->iconEmoji; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 | 3 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * Set the icon Emoji for a message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 | 3 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      * @param string $iconEmoji | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |     public function setIconEmoji(string $iconEmoji): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 | 23 |  |         $this->iconEmoji = $iconEmoji; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 | 23 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 | 23 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      * Returns state of markdown support of message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 | 3 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |     public function isMarkdown(): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 | 3 |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         return $this->markdown; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * Set the state of markdown support of message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 | 24 |  |      * @param bool $markdown | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 | 24 |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 | 24 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |     public function setMarkdown(bool $markdown): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         $this->markdown = $markdown; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 | 2 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 | 2 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |      * Returns main text of message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |     public function getText(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 | 24 |  |         return $this->text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 | 24 |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 | 24 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |      * Set the main text of message. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |      * @param string $text | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * @return SlackMessage | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 212 | 2 |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 213 |  |  |     public function setText(string $text): SlackMessage | 
            
                                                                        
                            
            
                                    
            
            
                | 214 | 2 |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 215 |  |  |         $this->text = $text; | 
            
                                                                        
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 217 |  |  |         return $this; | 
            
                                                                        
                            
            
                                    
            
            
                | 218 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 | 24 |  |      * Returns collection of Attachment DTOs. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 | 24 |  |      * @return Attachment[] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 | 24 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |     public function getAttachments(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |         return $this->attachments; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 | 2 |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |      * Set collection of Attachment DTOs. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 | 2 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |      * @param Attachment[] $attachments | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |     public function setAttachments(array $attachments): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 | 24 |  |         $this->attachments = $attachments; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 | 24 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 | 24 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |      * Appends Attachment DTO to collection. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |      * @param Attachment $attachment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 | 2 |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * @return SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 | 2 |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |     public function appendAttachment(Attachment $attachment): SlackMessage | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |         if (empty($this->attachments)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |             $this->attachments = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 | 24 |  |         $this->attachments[] = $attachment; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 | 24 |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 | 24 |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 261 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 262 |  |  |  |