Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function validate(string $phoneNumber, string $countryCode = null): void |
||
42 | { |
||
43 | try { |
||
44 | $number = $this->phoneNumberUtil->parse($phoneNumber, $countryCode ?? $this->countryCode); |
||
45 | } catch (NumberParseException $exception) { |
||
46 | throw new PhoneNumberCouldNotBeParsedException($phoneNumber); |
||
47 | } |
||
48 | |||
49 | if (!$this->phoneNumberUtil->isValidNumber($number)) { |
||
50 | throw new PhoneNumberInvalidException($phoneNumber); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |