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