Code Duplication    Length = 7-9 lines in 3 locations

src/Validator/Constraints/NotOverlappedDatesValidator.php 3 locations

@@ 144-150 (lines=7) @@
141
    private function validateDatesNotEmpty(EntityInterface $entity, NotOverlappedDates $constraint): bool
142
    {
143
        $result = true;
144
        if (!$this->getFromDate($entity, $constraint) instanceof \DateTimeInterface) {
145
            $this->context->buildViolation($constraint::INVALID_FROM_DATE)
146
                ->setParameter('{{ fromDate }}', 'N/A')
147
                ->atPath($constraint->fromDateProperty)
148
                ->addViolation();
149
            $result = false;
150
        }
151
        if (!$this->getToDate($entity, $constraint) instanceof \DateTimeInterface) {
152
            $this->context->buildViolation($constraint::INVALID_TO_DATE)
153
                ->setParameter('{{ toDate }}', 'N/A')
@@ 151-157 (lines=7) @@
148
                ->addViolation();
149
            $result = false;
150
        }
151
        if (!$this->getToDate($entity, $constraint) instanceof \DateTimeInterface) {
152
            $this->context->buildViolation($constraint::INVALID_TO_DATE)
153
                ->setParameter('{{ toDate }}', 'N/A')
154
                ->atPath($constraint->toDateProperty)
155
                ->addViolation();
156
            $result = false;
157
        }
158
159
        return $result;
160
    }
@@ 167-175 (lines=9) @@
164
        $fromDateString = $this->getFromDateString($entity, $constraint);
165
        $toDateString = $this->getToDateString($entity, $constraint);
166
167
        if ($fromDateString >= $toDateString) {
168
            $this->context->buildViolation($constraint::INVALID_ORDER)
169
                ->setParameter('{{ fromDate }}', $fromDateString)
170
                ->setParameter('{{ toDate }}', $toDateString)
171
                ->atPath($constraint->toDateProperty)
172
                ->addViolation();
173
174
            return false;
175
        }
176
177
        return true;
178
    }