class YamlDiscovery

Same name in this branch
  1. 11.x core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDiscovery
  2. 11.x core/lib/Drupal/Component/Discovery/YamlDiscovery.php \Drupal\Component\Discovery\YamlDiscovery
Same name in other branches
  1. 9 core/lib/Drupal/Core/Discovery/YamlDiscovery.php \Drupal\Core\Discovery\YamlDiscovery
  2. 9 core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDiscovery
  3. 9 core/lib/Drupal/Component/Discovery/YamlDiscovery.php \Drupal\Component\Discovery\YamlDiscovery
  4. 8.9.x core/lib/Drupal/Core/Discovery/YamlDiscovery.php \Drupal\Core\Discovery\YamlDiscovery
  5. 8.9.x core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDiscovery
  6. 8.9.x core/lib/Drupal/Component/Discovery/YamlDiscovery.php \Drupal\Component\Discovery\YamlDiscovery
  7. 10 core/lib/Drupal/Core/Discovery/YamlDiscovery.php \Drupal\Core\Discovery\YamlDiscovery
  8. 10 core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php \Drupal\Core\Plugin\Discovery\YamlDiscovery
  9. 10 core/lib/Drupal/Component/Discovery/YamlDiscovery.php \Drupal\Component\Discovery\YamlDiscovery

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

This overrides the Component file decoding with the Core YAML implementation.

Hierarchy

Expanded class hierarchy of YamlDiscovery

6 files declare their use of YamlDiscovery
MigrationState.php in core/modules/migrate_drupal/src/MigrationState.php
PermissionHandler.php in core/modules/user/src/PermissionHandler.php
RouteBuilder.php in core/lib/Drupal/Core/Routing/RouteBuilder.php
RouteBuilderTest.php in core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
YamlDiscovery.php in core/lib/Drupal/Core/Plugin/Discovery/YamlDiscovery.php

... See full list

File

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

Namespace

Drupal\Core\Discovery
View source
class YamlDiscovery extends ComponentYamlDiscovery {
    
    /**
     * {@inheritdoc}
     */
    protected function decode($file) {
        try {
            return Yaml::decode(file_get_contents($file)) ?: [];
        } catch (InvalidDataTypeException $e) {
            throw new InvalidDataTypeException($file . ': ' . $e->getMessage(), $e->getCode(), $e);
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
YamlDiscovery::$directories protected property An array of directories to scan, keyed by the provider.
YamlDiscovery::$name protected property The base filename to look for in each directory.
YamlDiscovery::decode protected function Decode a YAML file. Overrides YamlDiscovery::decode
YamlDiscovery::findAll public function Returns an array of discoverable items. Overrides DiscoverableInterface::findAll
YamlDiscovery::findFiles protected function Returns an array of file paths, keyed by provider.
YamlDiscovery::__construct public function Constructs a YamlDiscovery object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.