function Peast::__callStatic
Magic method that exposes all the functions to access parser with specific features
Parameters
string $version Parser version:
array $args Parser arguments:
Return value
Syntax\Parser
Throws
\Exception
File
-
vendor/
mck89/ peast/ lib/ Peast/ Peast.php, line 161
Class
- Peast
- Main class of Peast library. Every function of this class takes two arguments:
Namespace
PeastCode
public static function __callStatic($version, $args) {
$source = $args[0];
$options = isset($args[1]) ? $args[1] : array();
if (!in_array($version, self::$versions)) {
if ($version === "latest") {
$version = end(self::$versions);
}
elseif (isset(self::$versions[$version])) {
$version = self::$versions[$version];
}
else {
throw new \Exception("Invalid version {$version}");
}
}
$featuresClass = "\\Peast\\Syntax\\{$version}\\Features";
return new Syntax\Parser($source, new $featuresClass(), $options);
}