original_string: public static function rmdir($path, $removeNonEmpty = FALSE) {
  		$OK = FALSE;
  		$path = preg_replace('|/$|', '', $path); // Remove trailing slash
  
  		if (file_exists($path)) {
  			$OK = TRUE;
  
  			if (is_dir($path)) {
  				if ($removeNonEmpty == TRUE && $handle = opendir($path)) {
  					while ($OK && FALSE !== ($file = readdir($handle))) {
  						if ($file == '.' || $file == '..') {
  							continue;
  						}
  						$OK = self::rmdir($path . '/' . $file, $removeNonEmpty);
  					}
  					closedir($handle);
  				}
  				if ($OK) {
  					$OK = rmdir($path);
  				}
  
  			} else { // If $dirname is a file, simply remove it
  				$OK = unlink($path);
  			}
  
  			clearstatcache();
  		}
  
  		return $OK;
  	}
code: public static function rmdir($path, $removeNonEmpty = FALSE) {
  		$OK = FALSE;
  		$path = preg_replace('|/$|', '', $path); // Remove trailing slash
  
  		if (file_exists($path)) {
  			$OK = TRUE;
  
  			if (is_dir($path)) {
  				if ($removeNonEmpty == TRUE && $handle = opendir($path)) {
  					while ($OK && FALSE !== ($file = readdir($handle))) {
  						if ($file == '.' || $file == '..') {
  							continue;
  						}
  						$OK = self::rmdir($path . '/' . $file, $removeNonEmpty);
  					}
  					closedir($handle);
  				}
  				if ($OK) {
  					$OK = rmdir($path);
  				}
  
  			} else { // If $dirname is a file, simply remove it
  				$OK = unlink($path);
  			}
  
  			clearstatcache();
  		}
  
  		return $OK;
  	}
code_tokens: public static function rmdir ( $ path , $ removeNonEmpty = FALSE ) { $ OK = FALSE ; $ path = preg_replace ( '|/$|' , '' , $ path ) ; // Remove trailing slash if ( file_exists ( $ path ) ) { $ OK = TRUE ; if ( is_dir ( $ path ) ) { if ( $ removeNonEmpty == TRUE && $ handle = opendir ( $ path ) ) { while ( $ OK && FALSE !== ( $ file = readdir ( $ handle ) ) ) { if ( $ file == '.' || $ file == '..' ) { continue ; } $ OK = self :: rmdir ( $ path . '/' . $ file , $ removeNonEmpty ) ; } closedir ( $ handle ) ; } if ( $ OK ) { $ OK = rmdir ( $ path ) ; } } else { // If $dirname is a file, simply remove it $ OK = unlink ( $ path ) ; } clearstatcache ( ) ; } return $ OK ; }
docstring: Wrapper function for rmdir, allowing recursive deletion of folders and files
  
  @param string $path Absolute path to folder, see PHP rmdir() function. Removes trailing slash internally.
  @param boolean $removeNonEmpty Allow deletion of non-empty directories
  @return boolean TRUE if @rmdir went well!
docstring_tokens: Wrapper function for rmdir allowing recursive deletion of folders and files