Code Duplication    Length = 8-10 lines in 2 locations

src/PH/Bundle/CoreBundle/Validator/Constraint/AmountRangeValidator.php 2 locations

@@ 51-60 (lines=10) @@
48
        $min = $gatewayConfig['minAmount'];
49
        $max = $gatewayConfig['maxAmount'];
50
51
        if (null !== $max && null !== $value->getAmount() && $value->getAmount() > $max) {
52
            $this->context->buildViolation($constraint->maxMessage)
53
                ->setParameter('{{ value }}', $this->formatValue($value->getAmount() / 100, self::PRETTY_DATE))
54
                ->setParameter('{{ limit }}', $this->formatValue($max / 100, self::PRETTY_DATE))
55
                ->setCode(AmountRange::TOO_HIGH_ERROR)
56
                ->atPath('amount')
57
                ->addViolation();
58
59
            return;
60
        }
61
62
        if (null !== $min && null !== $value->getAmount() && $value->getAmount() < $min) {
63
            $this->context->buildViolation($constraint->minMessage)
@@ 62-69 (lines=8) @@
59
            return;
60
        }
61
62
        if (null !== $min && null !== $value->getAmount() && $value->getAmount() < $min) {
63
            $this->context->buildViolation($constraint->minMessage)
64
                ->setParameter('{{ value }}', $this->formatValue($value->getAmount() / 100, self::PRETTY_DATE))
65
                ->setParameter('{{ limit }}', $this->formatValue($min / 100, self::PRETTY_DATE))
66
                ->setCode(AmountRange::TOO_LOW_ERROR)
67
                ->atPath('amount')
68
                ->addViolation();
69
        }
70
    }
71
}
72