ParserFactory
in package
Parser factory to abstract over PHP parser library versions.
Table of Contents
- ONLY_PHP5 = 'ONLY_PHP5'
- ONLY_PHP7 = 'ONLY_PHP7'
- PREFER_PHP5 = 'PREFER_PHP5'
- PREFER_PHP7 = 'PREFER_PHP7'
- createParser() : Parser
- New parser instance with given kind.
- getDefaultKind() : string|null
- Default kind (if supported, based on current interpreter's version).
- getPossibleKinds() : array<string|int, mixed>
- Possible kinds of parsers for the factory, from PHP parser library.
- hasKindsSupport() : bool
- Is this parser factory supports kinds?
Constants
ONLY_PHP5
public
mixed
ONLY_PHP5
= 'ONLY_PHP5'
ONLY_PHP7
public
mixed
ONLY_PHP7
= 'ONLY_PHP7'
PREFER_PHP5
public
mixed
PREFER_PHP5
= 'PREFER_PHP5'
PREFER_PHP7
public
mixed
PREFER_PHP7
= 'PREFER_PHP7'
Methods
createParser()
New parser instance with given kind.
public
createParser([string|null $kind = null ]) : Parser
Parameters
- $kind : string|null = null
-
One of class constants (only for PHP parser 2.0 and above)
Return values
Parser —getDefaultKind()
Default kind (if supported, based on current interpreter's version).
public
getDefaultKind() : string|null
Return values
string|null —getPossibleKinds()
Possible kinds of parsers for the factory, from PHP parser library.
public
static getPossibleKinds() : array<string|int, mixed>
Return values
array<string|int, mixed> —hasKindsSupport()
Is this parser factory supports kinds?
public
hasKindsSupport() : bool
PHP parser < 2.0 doesn't support kinds, >= 2.0 — does.