class Math extends AbstractConvertor

Properties

protected RecursiveParser $parser from  AbstractRecursiveMatcher

Methods

void
__construct(RecursiveParser $parser)

No description

mixed
recurse(string $str, string $restrict = '')

Parse given string and return its value

string
getAttributeName(string $expr)

Retrieve the attribute name from an attribute expression

string
normalizeNumber(string $sign, string $number)

Normalize a number representation

array
getMatchers()

Return the matchers configuration

string
parseAddition(string $expr1, string $expr2)

Convert an addition

string
parseDivision(string $expr1, string $expr2)

Convert a division

string
parseMathSubExpr(string $expr)

Convert a math subexpression

string
parseMultiplication(string $expr1, string $expr2)

Convert a multiplication

string
parseSubstraction(string $expr1, string $expr2)

Convert a substraction

string
convertOperation(string $expr1, string $operator, string $expr2)

Convert an operation

Details

void __construct(RecursiveParser $parser)

No description

Parameters

RecursiveParser $parser

Return Value

void

protected mixed recurse(string $str, string $restrict = '')

Parse given string and return its value

Parameters

string $str
string $restrict

Pipe-separated list of allowed matches (ignored if empty)

Return Value

mixed

in AbstractConvertor at line 20
protected string getAttributeName(string $expr)

Retrieve the attribute name from an attribute expression

Parameters

string $expr

XPath expression for an attribute, e.g. '@foo'

Return Value

string

Attribute name, e.g. 'foo'

in AbstractConvertor at line 32
protected string normalizeNumber(string $sign, string $number)

Normalize a number representation

Parameters

string $sign
string $number

Return Value

string

at line 15
array getMatchers()

Return the matchers configuration

Match name as key. Can be prefixed with a colon-separated list of groups, e.g. "Group:Name". Value must be a string or an array with the following elements:

  • regexp: the regular expression used to match input.
  • order: used to sort matchers. Defaults to 0.
  • groups: list of groups this match belongs to. Defaults to an empty array.
  • callback: called with the matched strings. Defaults to [$this, "parseX"] where X is the match name.

If the config is a string, the string is used for the "regexp" element.

Return Value

array

at line 36
string parseAddition(string $expr1, string $expr2)

Convert an addition

Parameters

string $expr1
string $expr2

Return Value

string

at line 48
string parseDivision(string $expr1, string $expr2)

Convert a division

Parameters

string $expr1
string $expr2

Return Value

string

at line 59
string parseMathSubExpr(string $expr)

Convert a math subexpression

Parameters

string $expr

Return Value

string

at line 71
string parseMultiplication(string $expr1, string $expr2)

Convert a multiplication

Parameters

string $expr1
string $expr2

Return Value

string

at line 83
string parseSubstraction(string $expr1, string $expr2)

Convert a substraction

Parameters

string $expr1
string $expr2

Return Value

string

at line 96
protected string convertOperation(string $expr1, string $operator, string $expr2)

Convert an operation

Parameters

string $expr1
string $operator
string $expr2

Return Value

string