| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | 1794 | public function validate($value, Constraint $constraint) |
|
| 17 | { |
||
| 18 | 1794 | if (empty(trim($value))) { |
|
| 19 | 9 | return; |
|
| 20 | } |
||
| 21 | |||
| 22 | 1785 | $values = json_decode( |
|
| 23 | 1785 | file_get_contents(__DIR__.'/../data/reserved-usernames.json'), |
|
| 24 | 595 | true |
|
| 25 | 1190 | ); |
|
| 26 | |||
| 27 | 1785 | if (in_array($value, $values)) { |
|
| 28 | 1782 | $this->context->addViolation($constraint->message, [ |
|
| 29 | 1782 | '%value%' => $value, |
|
| 30 | 1188 | ]); |
|
| 31 | 1188 | } |
|
| 32 | 1785 | } |
|
| 33 | } |
||
| 34 |