Yaml::getSerializer

protected static Yaml::getSerializer()

Determines which implementation to use for parsing YAML.

File

core/lib/Drupal/Component/Serialization/Yaml.php, line 48

Class

Yaml
Provides a YAML serialization implementation.

Namespace

Drupal\Component\Serialization

Code

protected static function getSerializer() {

  if (!isset(static::$serializer)) {
    // Use the PECL YAML extension if it is available. It has better
    // performance for file reads and is YAML compliant.
    if (extension_loaded('yaml')) {
      static::$serializer = YamlPecl::class;
    }
    else {
      // Otherwise, fallback to the Symfony implementation.
      static::$serializer = YamlSymfony::class;
    }
  }
  return static::$serializer;
}
doc_Drupal
2016-10-29 09:56:54
Comments
Leave a Comment

Please login to continue.