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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.