Code Duplication    Length = 14-14 lines in 2 locations

Validator.php 2 locations

@@ 299-312 (lines=14) @@
296
            /** @var ClassMetadata $classMetadata */
297
            $classMetadata = $metadata->getRootClassMetadata();
298
299
            foreach ($classMetadata->getPropertiesMetadata() as $propertyMetadata) {
300
                foreach ($propertyMetadata->getConstraints() as $group => $constraints) {
301
                    $allOf = Assert::create();
302
                    foreach ($constraints as $constraint) {
303
                        $allOf->addRules($constraint->getRules());
304
                    }
305
306
                    $this->addConstraint(
307
                        Assert::create()->attribute($propertyMetadata->getPropertyName(), $allOf),
308
                        get_class($object),
309
                        $group
310
                    );
311
                }
312
            }
313
314
            foreach ($classMetadata->getMethodsMetadata() as $methodMetadata) {
315
                foreach ($methodMetadata->getConstraints() as $group => $constraints) {
@@ 314-327 (lines=14) @@
311
                }
312
            }
313
314
            foreach ($classMetadata->getMethodsMetadata() as $methodMetadata) {
315
                foreach ($methodMetadata->getConstraints() as $group => $constraints) {
316
                    $allOf = Assert::create();
317
                    foreach ($constraints as $constraint) {
318
                        $allOf->addRules($constraint->getRules());
319
                    }
320
321
                    $this->addConstraint(
322
                        Assert::create()->call([$object, $methodMetadata->getMethodName()], $allOf),
323
                        get_class($object),
324
                        $group
325
                    );
326
                }
327
            }
328
        }
329
    }
330