| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 4 | public function validate($value, $parameter, Validator $validator) |
|
| 19 | { |
||
| 20 | 4 | Assert::type($parameter, 'string', self::KEYWORD, $validator->getSchemaPath()); |
|
| 21 | |||
| 22 | 2 | if (!is_string($value)) { |
|
| 23 | 2 | return null; |
|
| 24 | } |
||
| 25 | |||
| 26 | 2 | if (preg_match(JsonGuard\delimit_pattern($parameter), $value) === 1) { |
|
| 27 | 2 | return null; |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | return error('The string must match the pattern {parameter}.', $validator); |
|
| 31 | } |
||
| 32 | } |
||
| 33 |