| @@ 12-25 (lines=14) @@ | ||
| 9 | /** |
|
| 10 | * @author Sullivan Senechal <[email protected]> |
|
| 11 | */ |
|
| 12 | final class IpValidator extends AbstractIsoCodesConstraintValidator |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * {@inheritdoc} |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | parent::validate($value, $constraint); |
|
| 20 | ||
| 21 | if ($value && !IsoCodes\IP::validate($value) && !IsoCodes\IP::validateIPV6($value)) { |
|
| 22 | $this->createViolation($constraint->message); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 12-25 (lines=14) @@ | ||
| 9 | /** |
|
| 10 | * @author Sullivan Senechal <[email protected]> |
|
| 11 | */ |
|
| 12 | final class IsbnValidator extends AbstractIsoCodesConstraintValidator |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * {@inheritdoc} |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | parent::validate($value, $constraint); |
|
| 20 | ||
| 21 | if ($value && !IsoCodes\Isbn::validate($value, $constraint->type)) { |
|
| 22 | $this->createViolation($constraint->message); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||