Code Duplication    Length = 15-15 lines in 5 locations

Validator/Constraints/CronDayOfMonthFormatValidator.php 1 location

@@ 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

Validator/Constraints/CronDayOfWeekFormatValidator.php 1 location

@@ 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

Validator/Constraints/CronHourFormatValidator.php 1 location

@@ 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

Validator/Constraints/CronMinuteFormatValidator.php 1 location

@@ 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

Validator/Constraints/CronMonthFormatValidator.php 1 location

@@ 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