| @@ 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 | /** |
|
| @@ 207-221 (lines=15) @@ | ||
| 204 | if ( ! class_exists($targetFqcn)) { |
|
| 205 | eval(substr($code, 5)); |
|
| 206 | } |
|
| 207 | } else { |
|
| 208 | $parentDirectory = dirname($fileName); |
|
| 209 | ||
| 210 | if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) { |
|
| 211 | throw PersistentCollectionException::directoryNotWritable(); |
|
| 212 | } |
|
| 213 | ||
| 214 | if ( ! is_writable($parentDirectory)) { |
|
| 215 | throw PersistentCollectionException::directoryNotWritable(); |
|
| 216 | } |
|
| 217 | ||
| 218 | $tmpFileName = $fileName . '.' . uniqid('', true); |
|
| 219 | file_put_contents($tmpFileName, $code); |
|
| 220 | rename($tmpFileName, $fileName); |
|
| 221 | } |
|
| 222 | } |
|
| 223 | ||
| 224 | private function generateMethod(\ReflectionMethod $method) |
|