| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | private static function recursiveCopy($src, $dst) |
||
| 44 | { |
||
| 45 | @mkdir($dst, 0755); |
||
| 46 | |||
| 47 | $iterator = new \RecursiveIteratorIterator( |
||
| 48 | new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS), |
||
| 49 | \RecursiveIteratorIterator::SELF_FIRST |
||
| 50 | ); |
||
| 51 | |||
| 52 | foreach ($iterator as $file) { |
||
| 53 | if ($file->isDir()) { |
||
| 54 | @mkdir($dst . '/' . $iterator->getSubPathName()); |
||
| 55 | } else { |
||
| 56 | $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
||
| 57 | if ($success) { |
||
| 58 | echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
If you suppress an error, we recommend checking for the error condition explicitly: