MediaWiki  1.29.2
QuickArrayReader Class Reference

Quickie parser class that can happily read the subset of PHP we need for our localization arrays safely. More...

Public Member Functions

 __construct ( $string)
 
 getVar ( $varname)
 
 parseScalar ( $token)
 Parse a scalar value in PHP. More...
 

Private Member Functions

 except ( $got, $expected)
 

Private Attributes

 $vars = []
 

Detailed Description

Quickie parser class that can happily read the subset of PHP we need for our localization arrays safely.

Still an order of magnitude slower than eval().

Definition at line 9 of file QuickArrayReader.php.

Constructor & Destructor Documentation

◆ __construct()

QuickArrayReader::__construct (   $string)
Parameters
$stringstring

Definition at line 15 of file QuickArrayReader.php.

References $tokens, captcha-old\count, except(), parseScalar(), wfRestoreWarnings(), and wfSuppressWarnings().

Member Function Documentation

◆ except()

QuickArrayReader::except (   $got,
  $expected 
)
private
Parameters
$gotstring
$expectedstring
Returns
Exception

Definition at line 143 of file QuickArrayReader.php.

Referenced by __construct().

◆ getVar()

QuickArrayReader::getVar (   $varname)
Parameters
$varnamestring
Returns
null|string

Definition at line 207 of file QuickArrayReader.php.

◆ parseScalar()

QuickArrayReader::parseScalar (   $token)

Parse a scalar value in PHP.

Parameters
$tokenstring
Returns
mixed Parsed value

Definition at line 160 of file QuickArrayReader.php.

References wfRestoreWarnings(), and wfSuppressWarnings().

Referenced by __construct().

Member Data Documentation

◆ $vars

QuickArrayReader::$vars = []
private

Definition at line 10 of file QuickArrayReader.php.


The documentation for this class was generated from the following file: