Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Peast.php

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

Peast

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal