| Conditions | 3 |
| Paths | 3 |
| Total Lines | 42 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | public static function validate(string $newPassword, string $verifyPassword): bool |
||
| 22 | { |
||
| 23 | $data = [ |
||
| 24 | 'new_password' => $newPassword, |
||
| 25 | 'verify_password' => $verifyPassword, |
||
| 26 | ]; |
||
| 27 | |||
| 28 | //Ok let validate user password |
||
| 29 | $validation = new Validation(); |
||
| 30 | |||
| 31 | $validation->add( |
||
| 32 | 'new_password', |
||
| 33 | new PresenceOf([ |
||
| 34 | 'message' => 'The password is required.' |
||
| 35 | ]) |
||
| 36 | ); |
||
| 37 | |||
| 38 | $validation->add( |
||
| 39 | 'new_password', |
||
| 40 | new StringLength([ |
||
| 41 | 'min' => 8, |
||
| 42 | 'messageMinimum' => 'Password is too short. Minimum 8 characters.', |
||
| 43 | ]) |
||
| 44 | ); |
||
| 45 | |||
| 46 | $validation->add( |
||
| 47 | 'new_password', |
||
| 48 | new Confirmation([ |
||
| 49 | 'message' => 'New password and confirmation do not match.', |
||
| 50 | 'with' => 'verify_password', |
||
| 51 | ]) |
||
| 52 | ); |
||
| 53 | |||
| 54 | //validate this form for password |
||
| 55 | $messages = $validation->validate($data); |
||
| 56 | if (count($messages)) { |
||
| 57 | foreach ($messages as $message) { |
||
| 58 | throw new Exception($message->getMessage()); |
||
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 62 | return true; |
||
| 63 | } |
||
| 65 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths