Code Duplication    Length = 15-16 lines in 2 locations

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

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

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)