Code Duplication    Length = 15-16 lines in 2 locations

lib/Doctrine/ODM/MongoDB/PersistentCollection/DefaultPersistentCollectionGenerator.php 1 location

@@ 165-179 (lines=15) @@
162
            if ( ! class_exists($targetFqcn)) {
163
                eval(substr($code, 5));
164
            }
165
        } else {
166
            $parentDirectory = dirname($fileName);
167
168
            if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) {
169
                throw PersistentCollectionException::directoryNotWritable();
170
            }
171
172
            if ( ! is_writable($parentDirectory)) {
173
                throw PersistentCollectionException::directoryNotWritable();
174
            }
175
176
            $tmpFileName = $fileName . '.' . uniqid('', true);
177
            file_put_contents($tmpFileName, $code);
178
            rename($tmpFileName, $fileName);
179
        }
180
    }
181
182
    private function generateMethod(\ReflectionMethod $method)

lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php 1 location

@@ 410-425 (lines=16) @@
407
            if ( ! class_exists($namespace . '\\' . $hydratorClassName)) {
408
                eval(substr($code, 5));
409
            }
410
        } else {
411
            $parentDirectory = dirname($fileName);
412
413
            if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) {
414
                throw HydratorException::hydratorDirectoryNotWritable();
415
            }
416
417
            if ( ! is_writable($parentDirectory)) {
418
                throw HydratorException::hydratorDirectoryNotWritable();
419
            }
420
421
            $tmpFileName = $fileName . '.' . uniqid('', true);
422
            file_put_contents($tmpFileName, $code);
423
            rename($tmpFileName, $fileName);
424
            chmod($fileName, 0664);
425
        }
426
    }
427
428
    /**