Code Duplication    Length = 15-20 lines in 2 locations

src/SMS.php 2 locations

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