PHP Class PhpParser\Parser\Multiple

Inheritance: implements PhpParser\Parser
Show file Open project: nikic/php-parser Class Usage Examples

Public Methods

Method Description
__construct ( array $parsers ) Create a parser which will try multiple parsers in an order of preference.
parse ( $code, PhpParser\ErrorHandler $errorHandler = null )

Private Methods

Method Description
tryParse ( PhpParser\Parser $parser, PhpParser\ErrorHandler $errorHandler, $code )

Method Details

__construct() public method

Parsers will be invoked in the order they're provided to the constructor. If one of the parsers runs without throwing, it's output is returned. Otherwise the exception that the first parser generated is thrown.
public __construct ( array $parsers )
$parsers array

parse() public method

public parse ( $code, PhpParser\ErrorHandler $errorHandler = null )
$errorHandler PhpParser\ErrorHandler