Code Duplication    Length = 9-15 lines in 2 locations

src/SMS.php 2 locations

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