tests/FilesystemHelper.php
c6601a15
 <?php
 
2119e60c
 namespace Twig\Tests;
 
c6601a15
 /*
  * This file is part of Twig.
  *
  * (c) Fabien Potencier
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
  */
 
2119e60c
 class FilesystemHelper
c6601a15
 {
     public static function removeDir($dir)
     {
010cfaf4
         $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::CHILD_FIRST);
c6601a15
         foreach ($iterator as $filename => $fileInfo) {
             if ($fileInfo->isDir()) {
                 rmdir($filename);
             } else {
                 unlink($filename);
             }
         }
         rmdir($dir);
     }
 }