function YamlDiscovery::decode
Decode a YAML file.
Parameters
string $file: Yaml file path.
Return value
array
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\DiscoveryCode
protected function decode($file) {
  try {
    return Yaml::decode(file_get_contents($file)) ?: [];
  } catch (InvalidDataTypeException $e) {
    throw new InvalidDataTypeException($file . ': ' . $e->getMessage(), $e->getCode(), $e);
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
