| Conditions | 6 |
| Paths | 1 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 18 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 21 | public function register() |
|
| 27 | { |
||
| 28 | $this->app->resolving('validator', function ($factory, $app) { |
||
|
|
|||
| 29 | |||
| 30 | 18 | $x = new Validator(); |
|
| 31 | |||
| 32 | 18 | $factory->extend('phone', function ($attribute, $value, $parameters, $validator) use ($x) { |
|
| 33 | 18 | if (count($parameters) > 0) { |
|
| 34 | 12 | switch ($parameters[0]) { |
|
| 35 | 12 | case 'e164': |
|
| 36 | 12 | case 'E164': |
|
| 37 | 6 | return $x->isE164($value); |
|
| 38 | 6 | case 'nanp': |
|
| 39 | 6 | case 'NANP': |
|
| 40 | 3 | return $x->isNANP($value); |
|
| 41 | 3 | default: |
|
| 42 | 3 | throw new Exception($parameters[0]." is not a supported phone validation type.", 1); |
|
| 43 | 3 | } |
|
| 44 | } else { |
||
| 45 | 6 | return $x->isPhone($value); |
|
| 46 | } |
||
| 47 | 18 | }, "Not a valid phone number"); |
|
| 48 | 21 | }); |
|
| 49 | 21 | } |
|
| 50 | } |
||
| 51 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.