| Total Complexity | 4 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class CountryLandlineCallback |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Country Validate classes. |
||
| 12 | */ |
||
| 13 | protected static array $validators = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Add new country validator. |
||
| 17 | * |
||
| 18 | * @throws \Throwable |
||
| 19 | */ |
||
| 20 | public static function addValidator(string $code, string $validator): void |
||
| 21 | { |
||
| 22 | if (! new $validator instanceof CountryLandlineValidator) { |
||
| 23 | throw new RuntimeException('The validator is not instance of CountryLandlineValidator'); |
||
| 24 | } |
||
| 25 | |||
| 26 | self::$validators[$code] = $validator; |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Call country validate class. |
||
| 31 | */ |
||
| 32 | public static function callLandlineValidator(string $code, $value) |
||
| 38 | } |
||
| 39 | } |
||
| 41 |