| Conditions | 5 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function boot() |
||
| 15 | { |
||
| 16 | \Validator::extend('ccn', function($attribute, $value, $parameters, $validator) { |
||
| 17 | return CreditCard::validCreditCard($value)['valid']; |
||
| 18 | }); |
||
| 19 | |||
| 20 | \Validator::extend('ccd', function($attribute, $value, $parameters, $validator) { |
||
| 21 | try { |
||
| 22 | $value = explode('/', $value); |
||
| 23 | return CreditCard::validDate(strlen($value[1]) == 2 ? (2000+$value[1]) : $value[1], $value[0]); |
||
| 24 | } catch(\Exception $e) { |
||
| 25 | return false; |
||
| 26 | } |
||
| 27 | }); |
||
| 28 | |||
| 29 | \Validator::extend('cvc', function($attribute, $value, $parameters, $validator) { |
||
| 30 | return ctype_digit($value) && (strlen($value) == 3 || strlen($value) == 4); |
||
| 31 | }); |
||
| 32 | } |
||
| 33 | |||
| 44 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.