original_string: public function removeDirectoryPhp($directory)
      {
          $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
          $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  
          foreach ($ri as $file) {
              if ($file->isDir()) {
                  $this->rmdir($file->getPathname());
              } else {
                  $this->unlink($file->getPathname());
              }
          }
  
          return $this->rmdir($directory);
      }
code: public function removeDirectoryPhp($directory)
      {
          $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
          $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  
          foreach ($ri as $file) {
              if ($file->isDir()) {
                  $this->rmdir($file->getPathname());
              } else {
                  $this->unlink($file->getPathname());
              }
          }
  
          return $this->rmdir($directory);
      }
code_tokens: public function removeDirectoryPhp ( $ directory ) { $ it = new RecursiveDirectoryIterator ( $ directory , RecursiveDirectoryIterator :: SKIP_DOTS ) ; $ ri = new RecursiveIteratorIterator ( $ it , RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ ri as $ file ) { if ( $ file -> isDir ( ) ) { $ this -> rmdir ( $ file -> getPathname ( ) ) ; } else { $ this -> unlink ( $ file -> getPathname ( ) ) ; } } return $ this -> rmdir ( $ directory ) ; }
docstring: Recursively delete directory using PHP iterators.
  
  Uses a CHILD_FIRST RecursiveIteratorIterator to sort files
  before directories, creating a single non-recursive loop
  to delete files/directories in the correct order.
  
  @param  string $directory
  @return bool
docstring_tokens: Recursively delete directory using PHP iterators .