Code Duplication    Length = 18-22 lines in 2 locations

src/Staff/MessageBuilder.php 1 location

@@ 128-149 (lines=22) @@
125
     *
126
     * @return bool
127
     */
128
    public function send()
129
    {
130
        if (empty($this->message)) {
131
            throw new RuntimeException('No message to send.');
132
        }
133
134
        $transformer = new Transformer();
135
136
        if ($this->message instanceof RawMessage) {
137
            $message = $this->message->get('content');
138
        } else {
139
            $content = $transformer->transform($this->message);
140
            $message = [
141
                'sender'   => $this->by,
142
                'receiver' => $this->to,
143
            ];
144
145
            $message = array_merge($message, $content);
146
        }
147
148
        return $this->staff->send($message);
149
    }
150
151
    /**
152
     * Return property.

src/Broadcast/MessageBuilder.php 1 location

@@ 209-226 (lines=18) @@
206
     *
207
     * @return bool
208
     */
209
    public function send()
210
    {
211
        if (empty($this->message)) {
212
            throw new RuntimeException('No message to send.');
213
        }
214
215
        $transformer = new Transformer();
216
217
        if ($this->message instanceof RawMessage) {
218
            $message = $this->message->get('content');
219
        } else {
220
            $content = $transformer->transform($this->message);
221
222
            $message = array_merge($this->to, ['agentid' => $this->agentId], ['safe' => $this->safe], $content);
223
        }
224
225
        return $this->broadcast->send($message);
226
    }
227
228
    /**
229
     * Return property.