Code Duplication    Length = 15-16 lines in 2 locations

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

@@ 402-417 (lines=16) @@
399
            if ( ! class_exists($namespace . '\\' . $hydratorClassName)) {
400
                eval(substr($code, 5));
401
            }
402
        } else {
403
            $parentDirectory = dirname($fileName);
404
405
            if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) {
406
                throw HydratorException::hydratorDirectoryNotWritable();
407
            }
408
409
            if ( ! is_writable($parentDirectory)) {
410
                throw HydratorException::hydratorDirectoryNotWritable();
411
            }
412
413
            $tmpFileName = $fileName . '.' . uniqid('', true);
414
            file_put_contents($tmpFileName, $code);
415
            rename($tmpFileName, $fileName);
416
            chmod($fileName, 0664);
417
        }
418
    }
419
420
    /**

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

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