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

Breadcrumb

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

class InfoParser

Parses extension .info.yml files.

Hierarchy

  • class \Drupal\Core\Extension\InfoParserDynamic implements \Drupal\Core\Extension\InfoParserInterface
    • class \Drupal\Core\Extension\InfoParser extends \Drupal\Core\Extension\InfoParserDynamic

Expanded class hierarchy of InfoParser

1 file declares its use of InfoParser
GenerateTheme.php in core/lib/Drupal/Core/Command/GenerateTheme.php

File

core/lib/Drupal/Core/Extension/InfoParser.php, line 12

Namespace

Drupal\Core\Extension
View source
class InfoParser extends InfoParserDynamic {
    
    /**
     * The file cache.
     *
     * @var \Drupal\Component\FileCache\FileCacheInterface
     */
    protected FileCacheInterface $fileCache;
    
    /**
     * InfoParser constructor.
     *
     * @param string $app_root
     *   The root directory of the Drupal installation.
     */
    public function __construct(string $app_root) {
        parent::__construct($app_root);
        if (FileCacheFactory::getPrefix() !== NULL) {
            $this->fileCache = FileCacheFactory::get('info_parser');
        }
        else {
            // Just use a static file cache when there is no prefix. This code path is
            // triggered when info is parsed prior to \Drupal\Core\DrupalKernel::boot()
            // running. This occurs during the very early installer and in some test
            // scenarios.
            $this->fileCache = new FileCache('info_parser', 'info_parser');
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public function parse($filename) {
        $data = $this->fileCache
            ->get($filename);
        if ($data === NULL) {
            $data = parent::parse($filename);
            $this->fileCache
                ->set($filename, $data);
        }
        return $data;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
InfoParser::$fileCache protected property The file cache.
InfoParser::parse public function Parses Drupal module, theme and profile .info.yml files. Overrides InfoParserDynamic::parse
InfoParser::__construct public function InfoParser constructor. Overrides InfoParserDynamic::__construct
InfoParserDynamic::getRequiredKeys protected function Returns an array of keys required to exist in .info.yml file.
RSS feed
Powered by Drupal