MediaWiki REL1_31
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.
 

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
string$string

Definition at line 15 of file QuickArrayReader.php.

References $tokens, except(), parseScalar(), wfRestoreWarnings(), and wfSuppressWarnings().

Member Function Documentation

◆ except()

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

Definition at line 143 of file QuickArrayReader.php.

Referenced by __construct().

◆ getVar()

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

Definition at line 207 of file QuickArrayReader.php.

◆ parseScalar()

QuickArrayReader::parseScalar ( $token)

Parse a scalar value in PHP.

Parameters
string$token
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: