original_string: protected function recursiveDelete($dir, $del = 0)
      {
  
          if (substr($dir, 0, 1) == '/') {
              throw new \Exception("You cannot delete root directories");
          }
  
          $iterator = new \RecursiveDirectoryIterator($dir);
          foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
              $name = $file->getFilename();
              if ($file->isDir() && $name != '.' && $name != '..') {
                  rmdir($file->getPathname());
              } elseif ($file->isFile()) {
                  unlink($file->getPathname());
              }
          }
  
          if ($del == 1) {
              rmdir($dir);
          }
      }
code: protected function recursiveDelete($dir, $del = 0)
      {
  
          if (substr($dir, 0, 1) == '/') {
              throw new \Exception("You cannot delete root directories");
          }
  
          $iterator = new \RecursiveDirectoryIterator($dir);
          foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
              $name = $file->getFilename();
              if ($file->isDir() && $name != '.' && $name != '..') {
                  rmdir($file->getPathname());
              } elseif ($file->isFile()) {
                  unlink($file->getPathname());
              }
          }
  
          if ($del == 1) {
              rmdir($dir);
          }
      }
code_tokens: protected function recursiveDelete ( $ dir , $ del = 0 ) { if ( substr ( $ dir , 0 , 1 ) == '/' ) { throw new \ Exception ( "You cannot delete root directories" ) ; } $ iterator = new \ RecursiveDirectoryIterator ( $ dir ) ; foreach ( new \ RecursiveIteratorIterator ( $ iterator , \ RecursiveIteratorIterator :: CHILD_FIRST ) as $ file ) { $ name = $ file -> getFilename ( ) ; if ( $ file -> isDir ( ) && $ name != '.' && $ name != '..' ) { rmdir ( $ file -> getPathname ( ) ) ; } elseif ( $ file -> isFile ( ) ) { unlink ( $ file -> getPathname ( ) ) ; } } if ( $ del == 1 ) { rmdir ( $ dir ) ; } }
docstring: Recursively deletes the files in a diretory
  
  @param string $dir The directory path
  @param boolean $del Should directory itself be deleted upon completion
  @return boolean
docstring_tokens: Recursively deletes the files in a diretory