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

@@ 141-155 (lines=15) @@
138
        $identifiers = [];
139
        $i = 0;
140
141
        foreach ($this->propertyNameCollectionFactory->create($resourceClass) as $propertyName) {
142
            $propertyMetadata = $this->propertyMetadataFactory->create($resourceClass, $propertyName);
143
144
            $identifier = $propertyMetadata->isIdentifier();
145
            if (null === $identifier || false === $identifier) {
146
                continue;
147
            }
148
149
            if (!isset($identifierValues[$i])) {
150
                throw new InvalidArgumentException(sprintf('Invalid identifier "%s".', $id));
151
            }
152
153
            $identifiers[$propertyName] = $identifierValues[$i];
154
            ++$i;
155
        }
156
157
        return $identifiers;
158
    }