| @@ 388-403 (lines=16) @@ | ||
| 385 | if ( ! class_exists($namespace . '\\' . $hydratorClassName)) { |
|
| 386 | eval(substr($code, 5)); |
|
| 387 | } |
|
| 388 | } else { |
|
| 389 | $parentDirectory = dirname($fileName); |
|
| 390 | ||
| 391 | if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) { |
|
| 392 | throw HydratorException::hydratorDirectoryNotWritable(); |
|
| 393 | } |
|
| 394 | ||
| 395 | if ( ! is_writable($parentDirectory)) { |
|
| 396 | throw HydratorException::hydratorDirectoryNotWritable(); |
|
| 397 | } |
|
| 398 | ||
| 399 | $tmpFileName = $fileName . '.' . uniqid('', true); |
|
| 400 | file_put_contents($tmpFileName, $code); |
|
| 401 | rename($tmpFileName, $fileName); |
|
| 402 | chmod($fileName, 0664); |
|
| 403 | } |
|
| 404 | } |
|
| 405 | ||
| 406 | /** |
|
| @@ 148-162 (lines=15) @@ | ||
| 145 | if ( ! class_exists($targetFqcn)) { |
|
| 146 | eval(substr($code, 5)); |
|
| 147 | } |
|
| 148 | } else { |
|
| 149 | $parentDirectory = dirname($fileName); |
|
| 150 | ||
| 151 | if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) { |
|
| 152 | throw PersistentCollectionException::directoryNotWritable(); |
|
| 153 | } |
|
| 154 | ||
| 155 | if ( ! is_writable($parentDirectory)) { |
|
| 156 | throw PersistentCollectionException::directoryNotWritable(); |
|
| 157 | } |
|
| 158 | ||
| 159 | $tmpFileName = $fileName . '.' . uniqid('', true); |
|
| 160 | file_put_contents($tmpFileName, $code); |
|
| 161 | rename($tmpFileName, $fileName); |
|
| 162 | } |
|
| 163 | } |
|
| 164 | ||
| 165 | private function generateMethod(\ReflectionMethod $method) |
|