| @@ 11-25 (lines=15) @@ | ||
| 8 | /** |
|
| 9 | * @author JM Leroux <[email protected]> |
|
| 10 | */ |
|
| 11 | class CronDayOfMonthFormatValidator extends ConstraintValidator |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @param string|int $value |
|
| 15 | * @param Constraint $constraint |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | if (is_numeric($value) && ($value < 1 || $value > 31)) { |
|
| 20 | $this->context->buildViolation($constraint->message) |
|
| 21 | ->setParameter('%string%', $value) |
|
| 22 | ->addViolation(); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 11-25 (lines=15) @@ | ||
| 8 | /** |
|
| 9 | * @author JM Leroux <[email protected]> |
|
| 10 | */ |
|
| 11 | class CronDayOfWeekFormatValidator extends ConstraintValidator |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @param string|int $value |
|
| 15 | * @param Constraint $constraint |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | if (is_numeric($value) && ($value < 0 || $value > 7)) { |
|
| 20 | $this->context->buildViolation($constraint->message) |
|
| 21 | ->setParameter('%string%', $value) |
|
| 22 | ->addViolation(); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 11-25 (lines=15) @@ | ||
| 8 | /** |
|
| 9 | * @author JM Leroux <[email protected]> |
|
| 10 | */ |
|
| 11 | class CronHourFormatValidator extends ConstraintValidator |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @param string|int $value |
|
| 15 | * @param Constraint $constraint |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | if (is_numeric($value) && ($value < 0 || $value > 23)) { |
|
| 20 | $this->context->buildViolation($constraint->message) |
|
| 21 | ->setParameter('%string%', $value) |
|
| 22 | ->addViolation(); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 11-25 (lines=15) @@ | ||
| 8 | /** |
|
| 9 | * @author JM Leroux <[email protected]> |
|
| 10 | */ |
|
| 11 | class CronMinuteFormatValidator extends ConstraintValidator |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @param string|int $value |
|
| 15 | * @param Constraint $constraint |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | if (is_numeric($value) && ($value < 0 || $value > 59)) { |
|
| 20 | $this->context->buildViolation($constraint->message) |
|
| 21 | ->setParameter('%string%', $value) |
|
| 22 | ->addViolation(); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 11-25 (lines=15) @@ | ||
| 8 | /** |
|
| 9 | * @author JM Leroux <[email protected]> |
|
| 10 | */ |
|
| 11 | class CronMonthFormatValidator extends ConstraintValidator |
|
| 12 | { |
|
| 13 | /** |
|
| 14 | * @param string|int $value |
|
| 15 | * @param Constraint $constraint |
|
| 16 | */ |
|
| 17 | public function validate($value, Constraint $constraint) |
|
| 18 | { |
|
| 19 | if (is_numeric($value) && ($value < 1 || $value > 12)) { |
|
| 20 | $this->context->buildViolation($constraint->message) |
|
| 21 | ->setParameter('%string%', $value) |
|
| 22 | ->addViolation(); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||