Total Complexity | 3 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class NormalizePhoneRequest implements Arrayable |
||
11 | { |
||
12 | use DataAware; |
||
13 | |||
14 | 1 | public static function one(string $phone, ?string $area = null, ?string $place = null, ?string $region = null): self |
|
15 | { |
||
16 | 1 | $request = new self(); |
|
17 | |||
18 | 1 | $request->addPhone(...\func_get_args()); |
|
|
|||
19 | |||
20 | 1 | return $request; |
|
21 | } |
||
22 | |||
23 | 1 | public function addPhone(string $phone, ?string $area = null, ?string $place = null, ?string $region = null): void |
|
24 | { |
||
25 | 1 | $this->data[] = \array_merge( |
|
26 | [ |
||
27 | 1 | 'id' => \sha1($phone), |
|
28 | 1 | 'original-phone' => $phone, |
|
29 | ], |
||
30 | 1 | \array_filter(\compact('area', 'place', 'region')) |
|
31 | ); |
||
32 | 1 | } |
|
33 | |||
34 | 1 | public function toArray(): array |
|
37 | } |
||
38 | } |
||
39 |