Code Duplication    Length = 7-9 lines in 3 locations

src/Validator/Constraints/NotOverlappedDatesValidator.php 3 locations

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