Code Duplication    Length = 7-7 lines in 2 locations

lib/Doctrine/ODM/MongoDB/Persisters/PersistenceBuilder.php 2 locations

@@ 149-155 (lines=7) @@
146
                if ($new === null && $mapping['nullable'] !== true) {
147
                    $updateData['$unset'][$mapping['name']] = true;
148
                } else {
149
                    if ($new !== null && isset($mapping['strategy']) && $mapping['strategy'] === ClassMetadataInfo::STORAGE_STRATEGY_INCREMENT) {
150
                        $operator = '$inc';
151
                        $value = Type::getType($mapping['type'])->convertToDatabaseValue($new - $old);
152
                    } else {
153
                        $operator = '$set';
154
                        $value = $new === null ? null : Type::getType($mapping['type'])->convertToDatabaseValue($new);
155
                    }
156
157
                    $updateData[$operator][$mapping['name']] = $value;
158
                }
@@ 247-253 (lines=7) @@
244
            // Scalar fields
245
            if ( ! isset($mapping['association'])) {
246
                if ($new !== null || $mapping['nullable'] === true) {
247
                    if ($new !== null && empty($mapping['id']) && isset($mapping['strategy']) && $mapping['strategy'] === ClassMetadataInfo::STORAGE_STRATEGY_INCREMENT) {
248
                        $operator = '$inc';
249
                        $value = Type::getType($mapping['type'])->convertToDatabaseValue($new - $old);
250
                    } else {
251
                        $operator = '$set';
252
                        $value = $new === null ? null : Type::getType($mapping['type'])->convertToDatabaseValue($new);
253
                    }
254
255
                    $updateData[$operator][$mapping['name']] = $value;
256
                }