Code Duplication    Length = 15-15 lines in 2 locations

src/Bridge/Doctrine/MongoDB/ItemDataProvider.php 1 location

@@ 73-87 (lines=15) @@
70
        $identifiers = [];
71
        $i = 0;
72
73
        foreach ($this->propertyNameCollectionFactory->create($resourceClass) as $propertyName) {
74
            $itemMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName);
75
76
            $identifier = $itemMetadata->isIdentifier();
77
            if (null === $identifier || false === $identifier) {
78
                continue;
79
            }
80
81
            if (!isset($identifierValues[$i])) {
82
                throw new InvalidArgumentException(sprintf('Invalid identifier "%s".', $id));
83
            }
84
85
            $identifiers[$propertyName] = $identifierValues[$i];
86
            ++$i;
87
        }
88
89
        if (!$fetchData || $manager instanceof DocumentManager) {
90
            return $manager->getReference($resourceClass, reset($identifiers));

src/Bridge/Doctrine/Orm/ItemDataProvider.php 1 location

@@ 75-89 (lines=15) @@
72
        $identifiers = [];
73
        $i = 0;
74
75
        foreach ($this->propertyNameCollectionFactory->create($resourceClass) as $propertyName) {
76
            $propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName);
77
78
            $identifier = $propertyMetadata->isIdentifier();
79
            if (null === $identifier || false === $identifier) {
80
                continue;
81
            }
82
83
            if (!isset($identifierValues[$i])) {
84
                throw new InvalidArgumentException(sprintf('Invalid identifier "%s".', $id));
85
            }
86
87
            $identifiers[$propertyName] = $identifierValues[$i];
88
            ++$i;
89
        }
90
91
        if (!$fetchData && $manager instanceof EntityManagerInterface) {
92
            return $manager->getReference($resourceClass, $identifiers);