Code Duplication    Length = 9-15 lines in 2 locations

src/SMS.php 2 locations

@@ 213-227 (lines=15) @@
210
        $this->endpoint = self::BASE_URL.self::SMS_ENDPOINT;
211
212
        if ($this->batch_type === BatchType::NOT_BATCH) {
213
            if (is_array($this->message) && array_depth($this->message) == 2 && count($this->message) == 1) {
214
                if (is_array($this->recipients) && array_depth($this->recipients) == 2 && count($this->recipients) == 1) {
215
                    $response = $this->sendForNonBatch($this->buildSendObject($this->recipients, $this->message));
216
                } else {
217
                    throw new BongaTechException('The recipient MUST be an array of depth 2 and count should not be more than 1');
218
                }
219
            } else {
220
                throw new BongaTechException('Message should be provided as an array whose depth is 2 and count should equal 1');
221
            }
222
        } elseif ($this->batch_type === BatchType::BATCH) {
223
            if (is_array($this->message) && array_depth($this->message) == 2 && count($this->message) > 0) {
224
                if (is_array($this->recipients) && array_depth($this->recipients) == 2 && count($this->recipients) > 1) {
225
                    $response = $this->sendForBatch($this->buildSendObject($this->recipients, $this->message));
226
                } else {
227
                    throw new BongaTechException('The recipients MUST be an array of depth 2 and count should be more than 1');
228
                }
229
            } else {
230
                throw new BongaTechException('Message should be provided as an array whose depth should be 2');
@@ 223-231 (lines=9) @@
220
                throw new BongaTechException('Message should be provided as an array whose depth is 2 and count should equal 1');
221
            }
222
        } elseif ($this->batch_type === BatchType::BATCH) {
223
            if (is_array($this->message) && array_depth($this->message) == 2 && count($this->message) > 0) {
224
                if (is_array($this->recipients) && array_depth($this->recipients) == 2 && count($this->recipients) > 1) {
225
                    $response = $this->sendForBatch($this->buildSendObject($this->recipients, $this->message));
226
                } else {
227
                    throw new BongaTechException('The recipients MUST be an array of depth 2 and count should be more than 1');
228
                }
229
            } else {
230
                throw new BongaTechException('Message should be provided as an array whose depth should be 2');
231
            }
232
        } else {
233
            throw new BongaTechException('Message Batch Type has not been set.');
234
        }