| @@ 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 | /** |
|
| @@ 143-157 (lines=15) @@ | ||
| 140 | if ( ! class_exists($targetFqcn)) { |
|
| 141 | eval(substr($code, 5)); |
|
| 142 | } |
|
| 143 | } else { |
|
| 144 | $parentDirectory = dirname($fileName); |
|
| 145 | ||
| 146 | if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) { |
|
| 147 | throw PersistentCollectionException::directoryNotWritable(); |
|
| 148 | } |
|
| 149 | ||
| 150 | if ( ! is_writable($parentDirectory)) { |
|
| 151 | throw PersistentCollectionException::directoryNotWritable(); |
|
| 152 | } |
|
| 153 | ||
| 154 | $tmpFileName = $fileName . '.' . uniqid('', true); |
|
| 155 | file_put_contents($tmpFileName, $code); |
|
| 156 | rename($tmpFileName, $fileName); |
|
| 157 | } |
|
| 158 | } |
|
| 159 | ||
| 160 | private function generateMethod(\ReflectionMethod $method) |
|