Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 401] [Versions 39 and 311]

(no description)

File Size: 329 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

GlobalFunctionsHelper:: (23 methods):
  fopen()
  fgets()
  fputs()
  fflush()
  fseek()
  fgetcsv()
  fputcsv()
  fwrite()
  fclose()
  rewind()
  file_exists()
  file_get_contents()
  convertToUseRealPath()
  isZipStream()
  feof()
  is_readable()
  basename()
  header()
  ob_end_clean()
  iconv()
  mb_convert_encoding()
  stream_get_wrappers()
  function_exists()


Class: GlobalFunctionsHelper  - X-Ref

Class GlobalFunctionsHelper
This class wraps global functions to facilitate testing

fopen($fileName, $mode)   X-Ref
Wrapper around global function fopen()

param: string $fileName
param: string $mode
return: resource|bool

fgets($handle, $length = null)   X-Ref
Wrapper around global function fgets()

param: resource $handle
param: int|null $length
return: string

fputs($handle, $string)   X-Ref
Wrapper around global function fputs()

param: resource $handle
param: string $string
return: int

fflush($handle)   X-Ref
Wrapper around global function fflush()

param: resource $handle
return: bool

fseek($handle, $offset)   X-Ref
Wrapper around global function fseek()

param: resource $handle
param: int $offset
return: int

fgetcsv($handle, $length = null, $delimiter = null, $enclosure = null)   X-Ref
Wrapper around global function fgetcsv()

param: resource $handle
param: int|null $length
param: string|null $delimiter
param: string|null $enclosure
return: array

fputcsv($handle, array $fields, $delimiter = null, $enclosure = null)   X-Ref
Wrapper around global function fputcsv()

param: resource $handle
param: array $fields
param: string|null $delimiter
param: string|null $enclosure
return: int

fwrite($handle, $string)   X-Ref
Wrapper around global function fwrite()

param: resource $handle
param: string $string
return: int

fclose($handle)   X-Ref
Wrapper around global function fclose()

param: resource $handle
return: bool

rewind($handle)   X-Ref
Wrapper around global function rewind()

param: resource $handle
return: bool

file_exists($fileName)   X-Ref
Wrapper around global function file_exists()

param: string $fileName
return: bool

file_get_contents($filePath)   X-Ref
Wrapper around global function file_get_contents()

param: string $filePath
return: string

convertToUseRealPath($filePath)   X-Ref
Updates the given file path to use a real path.
This is to avoid issues on some Windows setup.

param: string $filePath File path
return: string The file path using a real path

isZipStream($path)   X-Ref
Returns whether the given path is a zip stream.

param: string $path Path pointing to a document
return: bool TRUE if path is a zip stream, FALSE otherwise

feof($handle)   X-Ref
Wrapper around global function feof()

param: resource $handle
return: bool

is_readable($fileName)   X-Ref
Wrapper around global function is_readable()

param: string $fileName
return: bool

basename($path, $suffix = null)   X-Ref
Wrapper around global function basename()

param: string $path
param: string|null $suffix
return: string

header($string)   X-Ref
Wrapper around global function header()

param: string $string
return: void

ob_end_clean()   X-Ref
Wrapper around global function ob_end_clean()

return: void

iconv($string, $sourceEncoding, $targetEncoding)   X-Ref
Wrapper around global function iconv()

param: string $string The string to be converted
param: string $sourceEncoding The encoding of the source string
param: string $targetEncoding The encoding the source string should be converted to
return: string|bool the converted string or FALSE on failure.

mb_convert_encoding($string, $sourceEncoding, $targetEncoding)   X-Ref
Wrapper around global function mb_convert_encoding()

param: string $string The string to be converted
param: string $sourceEncoding The encoding of the source string
param: string $targetEncoding The encoding the source string should be converted to
return: string|bool the converted string or FALSE on failure.

stream_get_wrappers()   X-Ref
Wrapper around global function stream_get_wrappers()

return: array

function_exists($functionName)   X-Ref
Wrapper around global function function_exists()

param: string $functionName
return: bool