| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function writeFromReader(ResourceReader $reader, $target) |
||
| 15 | { |
||
| 16 | $directory = dirname($target); |
||
| 17 | if (!is_dir($directory)) { |
||
| 18 | mkdir($directory, 0777, true); |
||
| 19 | } |
||
| 20 | |||
| 21 | $targetResource = fopen($target, 'w+'); |
||
| 22 | $sourceResource = $reader->getContentsAsStream(); |
||
| 23 | |||
| 24 | stream_copy_to_stream($sourceResource, $targetResource); |
||
| 25 | fclose($targetResource); |
||
| 26 | } |
||
| 27 | } |
||
| 28 |