| Conditions | 4 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function validate($value, Constraint $constraint) |
||
| 19 | { |
||
| 20 | // If the first occurrence of $value is the # character it's an anchor any check is done |
||
| 21 | if (strpos($value, '#') === 0) { |
||
| 22 | return; |
||
| 23 | } |
||
| 24 | |||
| 25 | $match = true; |
||
| 26 | $code = $this->checker->check($value); |
||
| 27 | if ($code === URLChecker::URL_NOT_FOUND) { |
||
| 28 | $match = false; |
||
| 29 | } |
||
| 30 | |||
| 31 | if ($match === false) { |
||
| 32 | $this->context->buildViolation($constraint->message) |
||
| 33 | ->setParameter('%string%', $value) |
||
| 34 | ->addViolation(); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | } |
||
| 38 |