33a244b069ae527c456ae2f79087ad7a35c6d0c7
[yaffs-website] / FSUtils.php
1 <?php
2 namespace Drush;
3
4 // We want to avoid using symfony/filesystem in the isolation tests.
5 trait FSUtils
6 {
7     function removeDir($dir)
8     {
9         $files = array_diff(scandir($dir), ['.','..']);
10         foreach ($files as $file) {
11             if (is_dir("$dir/$file") && !is_link("$dir/$file")) {
12                 $this->removeDir("$dir/$file");
13             } else {
14                 unlink("$dir/$file");
15             }
16         }
17         return rmdir($dir);
18     }
19 }