Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(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()

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

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

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

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

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

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

return: bool
param: resource $handle

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

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

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

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

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

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

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

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

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

return: bool
param: resource $handle

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

return: bool
param: resource $handle

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

return: bool
param: string $fileName

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

return: string
param: string $filePath

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

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

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

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

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

return: bool
param: resource $handle

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

return: bool
param: string $fileName

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

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

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

return: void
param: string $string

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()

return: string|bool the converted string or FALSE on failure.
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

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

return: string|bool the converted string or FALSE on failure.
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

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()

return: bool
param: string $functionName