original_string: public static function recursiveUnlink($dir) {
          $result = TRUE;
  
          if(is_dir($dir)) {
              foreach(scandir($dir) as $sub) {
                  if(in_array($sub, ['.', '..'])) continue;
                  $result &= self::recursiveUnlink("$dir/$sub");
              }
  
              $result &= rmdir($dir);
          }
          elseif(is_file($dir)) {
              $result &= unlink($dir);
          }
          else {
              $result = FALSE;
          }
  
          return (bool)$result;
      }
code: public static function recursiveUnlink($dir) {
          $result = TRUE;
  
          if(is_dir($dir)) {
              foreach(scandir($dir) as $sub) {
                  if(in_array($sub, ['.', '..'])) continue;
                  $result &= self::recursiveUnlink("$dir/$sub");
              }
  
              $result &= rmdir($dir);
          }
          elseif(is_file($dir)) {
              $result &= unlink($dir);
          }
          else {
              $result = FALSE;
          }
  
          return (bool)$result;
      }
code_tokens: public static function recursiveUnlink ( $ dir ) { $ result = TRUE ; if ( is_dir ( $ dir ) ) { foreach ( scandir ( $ dir ) as $ sub ) { if ( in_array ( $ sub , [ '.' , '..' ] ) ) continue ; $ result &= self :: recursiveUnlink ( "$dir/$sub" ) ; } $ result &= rmdir ( $ dir ) ; } elseif ( is_file ( $ dir ) ) { $ result &= unlink ( $ dir ) ; } else { $ result = FALSE ; } return ( bool ) $ result ; }
docstring: Recursively unlinks a directory
  
  @param string $dir The target directory that will be removed
  @param bool TRUE on success or FALSE on failure
docstring_tokens: Recursively unlinks a directory