Code Duplication    Length = 15-20 lines in 2 locations

src/SMS.php 2 locations

@@ 196-210 (lines=15) @@
193
194
        if ($this->batch_type === BatchType::NOT_BATCH) {
195
196
            if (is_array($this->message) && array_depth($this->message) == 2 && count($this->message) == 1) {
197
198
                if (is_array($this->recipients) && array_depth($this->recipients) == 2 && count($this->recipients) == 1) {
199
200
                    $response = $this->sendForNonBatch($this->buildSendObject($this->recipients, $this->message));
201
202
                } else {
203
204
                    throw new BongaTechException('The recipient MUST be an array of depth 2 and count should not be more than 1');
205
                }
206
207
            } else {
208
209
                throw new BongaTechException('Message should be provided as an array whose depth is 2 and count should equal 1');
210
            }
211
212
213
        } elseif ($this->batch_type === BatchType::SAME_MESSAGE) {
@@ 213-232 (lines=20) @@
210
            }
211
212
213
        } elseif ($this->batch_type === BatchType::SAME_MESSAGE) {
214
215
            if (is_array($this->message) && array_depth($this->message) == 2 && count($this->message) == 1) {
216
217
                if (is_array($this->recipients) && array_depth($this->recipients) == 2 && count($this->recipients) > 1) {
218
219
                    $response = $this->sendForBatch($this->buildSendObject($this->recipients, $this->message));
220
221
                } else {
222
223
                    throw new BongaTechException('The recipients MUST be an array of depth 2 and count should be more than 1');
224
                }
225
226
227
            } else {
228
229
                throw new BongaTechException('Message should be provided as an array whose depth and count should equal 1');
230
            }
231
232
        } elseif ($this->batch_type === BatchType::DIFFERENT_MESSAGE) {
233
234
            if (count($this->recipients) == count($this->message)) {
235