Plivo::handleParamKey()   B
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 19
Code Lines 15

Duplication

Lines 19
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 11.1035

Importance

Changes 0
Metric Value
dl 19
loc 19
ccs 6
cts 16
cp 0.375
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 15
nc 5
nop 2
crap 11.1035
1
<?php
2
3
namespace LeadThread\Sms\Search;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use Exception;
7
8
class Plivo extends Search
9
{
10 3
    protected function getBaseArray()
11
    {
12 3
        return ['type' => 'local', 'services' => 'sms'];
13
    }
14
15 3 View Code Duplication
    protected function handleParamKey($key, &$arr)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17
        switch ($key) {
18 3
            case 'areacode':
19
                $arr["pattern"] = $this->{$key};
20
                break;
21 3
            case 'country':
22 3
                $arr["country_iso"] = $this->{$key};
23 3
                break;
24
            case 'state':
25
                if (!empty($this->{$key})) {
26
                    throw new Exception("The \"state\" search parameter is not supported by Plivo", 1);
27
                }
28
                break;
29
            default:
30
                $arr[$key] = $this->{$key};
31
                break;
32
        }
33 3
    }
34
}
35