Code Duplication    Length = 6-6 lines in 2 locations

Classes/Controller/AbstractHookController.php 1 location

@@ 59-64 (lines=6) @@
56
    {
57
        $data = $this->getBaseDataArray($payload->getText(), $channel);
58
        $attachments = $payload->getAttachments();
59
        if (count($attachments)) {
60
            $data['attachments'] = [];
61
            foreach ($attachments as $attachment) {
62
                $data['attachments'][] = $this->buildAttachment($attachment);
63
            }
64
        }
65
        if (!empty($this->configuration['slack']['botAvatar'])) {
66
            $data['icon_emoji'] = $this->configuration['slack']['botAvatar'];
67
        }

Classes/Commands/AbstractCommand.php 1 location

@@ 206-211 (lines=6) @@
203
        if ($messageToSent instanceof Message) {
204
            $data = $this->getBaseDataArray($messageToSent->getText(), $channel);
205
            $attachments = $messageToSent->getAttachments();
206
            if (count($attachments)) {
207
                $data['attachments'] = [];
208
                foreach ($attachments as $attachment) {
209
                    $data['attachments'][] = $this->buildAttachment($attachment);
210
                }
211
            }
212
            $message = new \Slack\Message\Message($this->client, $data);
213
            $this->client->postMessage($message);
214
        } elseif (is_string($messageToSent)) {