Total Complexity | 10 |
Total Lines | 73 |
Duplicated Lines | 0 % |
Coverage | 92.59% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class PhoneNumberDetails |
||
6 | { |
||
7 | /** @var string */ |
||
8 | private $number; |
||
9 | |||
10 | /** @var string */ |
||
11 | private $type; |
||
12 | |||
13 | /** @var string */ |
||
14 | private $operator; |
||
15 | |||
16 | /** @var string */ |
||
17 | private $province = null; |
||
18 | |||
19 | /** @var string */ |
||
20 | private $district = null; |
||
21 | |||
22 | /** @var string */ |
||
23 | private $area = null; |
||
24 | |||
25 | 48 | public function __construct(string $number, string $type, string $operator, array $location = null) |
|
26 | { |
||
27 | 48 | $this->number = $number; |
|
28 | 48 | $this->type = $type; |
|
29 | 48 | $this->operator = $operator; |
|
30 | |||
31 | 48 | if ($location !== null) { |
|
32 | 21 | $this->province = $location['province']; |
|
33 | 21 | $this->district = $location['district']; |
|
34 | 21 | $this->area = $location['area']; |
|
35 | } |
||
36 | 48 | } |
|
37 | |||
38 | 18 | public function getNumber(): string |
|
39 | { |
||
40 | 18 | return $this->number; |
|
41 | } |
||
42 | |||
43 | public function getType(): string |
||
44 | { |
||
45 | return $this->type; |
||
46 | } |
||
47 | |||
48 | 3 | public function getOperator(): string |
|
49 | { |
||
50 | 3 | return $this->operator; |
|
51 | } |
||
52 | |||
53 | 6 | public function getProvince(): string |
|
54 | { |
||
55 | 6 | $this->checkLocationDetails(); |
|
56 | |||
57 | 3 | return $this->province; |
|
58 | } |
||
59 | |||
60 | 6 | public function getDistrict(): string |
|
65 | } |
||
66 | |||
67 | 6 | public function getArea(): string |
|
72 | } |
||
73 | |||
74 | 12 | private function checkLocationDetails(): void |
|
78 | } |
||
79 | 3 | } |
|
80 | } |
||
81 |