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

Breadcrumb

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

function YamlDiscovery::decode

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/Discovery/YamlDiscovery.php \Drupal\Component\Discovery\YamlDiscovery::decode()

Overrides YamlDiscovery::decode

File

core/lib/Drupal/Core/Discovery/YamlDiscovery.php, line 19

Class

YamlDiscovery
Provides discovery for YAML files within a given set of directories.

Namespace

Drupal\Core\Discovery

Code

protected function decode($file) {
    try {
        return Yaml::decode(file_get_contents($file)) ?: [];
    } catch (InvalidDataTypeException $e) {
        throw new InvalidDataTypeException($file . ': ' . $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