You are here

public static function CommonMark::environmentClass in Markdown 8.2

Retrieves the environment class to be used.

Return value

string|\League\CommonMark\Environment\Environment|\League\CommonMark\Environment The environment class.

2 calls to CommonMark::environmentClass()
CommonMark::createEnvironment in src/Plugin/Markdown/CommonMark/CommonMark.php
Creates an environment.
CommonMarkGfm::createEnvironment in src/Plugin/Markdown/CommonMark/CommonMarkGfm.php
Creates an environment.

File

src/Plugin/Markdown/CommonMark/CommonMark.php, line 162

Class

CommonMark
Support for CommonMark by The League of Extraordinary Packages.

Namespace

Drupal\markdown\Plugin\Markdown\CommonMark

Code

public static function environmentClass() {
  if (!isset(static::$environmentClass)) {
    $classes = [
      // 2.x.
      '\\League\\CommonMark\\Environment\\Environment',
      // 0.x, 1.x.
      '\\League\\CommonMark\\Environment',
    ];
    foreach ($classes as $class) {
      if (class_exists($class)) {
        static::$environmentClass = $class;
      }
    }
  }
  return static::$environmentClass;
}