original_string: protected function deleteRecursive($path)
      {
          if (is_file($path) || is_link($path)) {
              return unlink($path);
          }
          $success = true;
          $dir = dir($path);
          while (($entry = $dir->read()) !== false) {
              if ($entry == '.' || $entry == '..') {
                  continue;
              }
              $entry_path = $path . '/' . $entry;
              $success = static::deleteRecursive($entry_path) && $success;
          }
          $dir->close();
  
          return rmdir($path) && $success;
      }
code: protected function deleteRecursive($path)
      {
          if (is_file($path) || is_link($path)) {
              return unlink($path);
          }
          $success = true;
          $dir = dir($path);
          while (($entry = $dir->read()) !== false) {
              if ($entry == '.' || $entry == '..') {
                  continue;
              }
              $entry_path = $path . '/' . $entry;
              $success = static::deleteRecursive($entry_path) && $success;
          }
          $dir->close();
  
          return rmdir($path) && $success;
      }
code_tokens: protected function deleteRecursive ( $ path ) { if ( is_file ( $ path ) || is_link ( $ path ) ) { return unlink ( $ path ) ; } $ success = true ; $ dir = dir ( $ path ) ; while ( ( $ entry = $ dir -> read ( ) ) !== false ) { if ( $ entry == '.' || $ entry == '..' ) { continue ; } $ entry_path = $ path . '/' . $ entry ; $ success = static :: deleteRecursive ( $ entry_path ) && $ success ; } $ dir -> close ( ) ; return rmdir ( $ path ) && $ success ; }
docstring: Helper method to remove directories and the files they contain.
  
  @param string $path
  The directory or file to remove. It must exist.
  
  @return bool
  TRUE on success or FALSE on failure.
docstring_tokens: Helper method to remove directories and the files they contain .