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

Breadcrumb

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

function Yaml::decode

Overrides SerializationInterface::decode

7 calls to Yaml::decode()
Finder::__construct in core/lib/Drupal/Core/DefaultContent/Finder.php
GenerateTheme::execute in core/lib/Drupal/Core/Command/GenerateTheme.php
Executes the current command.
GenerateTheme::loadStarterKitConfig in core/lib/Drupal/Core/Command/GenerateTheme.php
InstalledPackage::scanForProjectName in core/modules/package_manager/src/InstalledPackage.php
Scans a given path to determine the Drupal project name.
Recipe::parse in core/lib/Drupal/Core/Recipe/Recipe.php
Parses and validates a recipe.yml file.

... See full list

File

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

Class

Yaml
Provides a YAML serialization implementation using symfony/yaml.

Namespace

Drupal\Component\Serialization

Code

public static function decode($raw) {
    try {
        $yaml = new Parser();
        // Make sure we have a single trailing newline. A very simple config like
        // 'foo: bar' with no newline will fail to parse otherwise.
        return $yaml->parse($raw, SymfonyYaml::PARSE_EXCEPTION_ON_INVALID_TYPE | SymfonyYaml::PARSE_CUSTOM_TAGS);
    } catch (\Exception $e) {
        throw new InvalidDataTypeException($e->getMessage(), $e->getCode(), $e);
    }
}

API Navigation

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