Code Duplication    Length = 21-21 lines in 3 locations

src/Constraints/IdVNValidator.php 1 location

@@ 19-39 (lines=21) @@
16
 * @author Vuong Minh <[email protected]>
17
 * @since 1.0.0
18
 */
19
class IdVNValidator extends ConstraintValidator
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function validate($value, Constraint $constraint): void
25
    {
26
        if (! $constraint instanceof IdVN) {
27
            throw new UnexpectedTypeException($constraint, IdVN::class);
28
        }
29
30
        if (false === ConcreteValidator::idVN()->validate($value)) {
31
            $this->context->buildViolation($constraint->message)
32
                ->setParameter('{{ value }}', $this->formatValue($value))
33
                ->setCode(IdVN::ID_VN_ERROR)
34
                ->addViolation();
35
        }
36
    }
37
}
38

src/Constraints/LandLineVNValidator.php 1 location

@@ 19-39 (lines=21) @@
16
 * @author Vuong Minh <[email protected]>
17
 * @since 1.0.0
18
 */
19
class LandLineVNValidator extends ConstraintValidator
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function validate($value, Constraint $constraint): void
25
    {
26
        if (! $constraint instanceof LandLineVN) {
27
            throw new UnexpectedTypeException($constraint, LandLineVN::class);
28
        }
29
30
        if (false === ConcreteValidator::landLineVN()->validate($value)) {
31
            $this->context->buildViolation($constraint->message)
32
                ->setParameter('{{ value }}', $this->formatValue($value))
33
                ->setCode(LandLineVN::LAND_LINE_VN_ERROR)
34
                ->addViolation();
35
        }
36
    }
37
}
38

src/Constraints/MobileVNValidator.php 1 location

@@ 19-39 (lines=21) @@
16
 * @author Vuong Minh <[email protected]>
17
 * @since 1.0.0
18
 */
19
class MobileVNValidator extends ConstraintValidator
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function validate($value, Constraint $constraint): void
25
    {
26
        if (! $constraint instanceof MobileVN) {
27
            throw new UnexpectedTypeException($constraint, MobileVN::class);
28
        }
29
30
        if (false === ConcreteValidator::mobileVN()->validate($value)) {
31
            $this->context->buildViolation($constraint->message)
32
                ->setParameter('{{ value }}', $this->formatValue($value))
33
                ->setCode(MobileVN::MOBILE_VN_ERROR)
34
                ->addViolation();
35
        }
36
    }
37
}
38