function Config::getAllCleanupPaths

Same name in other branches
  1. 9 composer/Plugin/VendorHardening/Config.php \Drupal\Composer\Plugin\VendorHardening\Config::getAllCleanupPaths()
  2. 8.9.x composer/Plugin/VendorHardening/Config.php \Drupal\Composer\Plugin\VendorHardening\Config::getAllCleanupPaths()
  3. 10 composer/Plugin/VendorHardening/Config.php \Drupal\Composer\Plugin\VendorHardening\Config::getAllCleanupPaths()

Gets the configured list of directories to remove from the root package.

This is stored in composer.json extra:drupal-core-vendor-hardening.

Return value

array[] An array keyed by package name. Each array value is an array of paths, relative to the package.

1 call to Config::getAllCleanupPaths()
Config::getPathsForPackage in composer/Plugin/VendorHardening/Config.php
Get a list of paths to remove for the given package.

File

composer/Plugin/VendorHardening/Config.php, line 117

Class

Config
Determine configuration.

Namespace

Drupal\Composer\Plugin\VendorHardening

Code

public function getAllCleanupPaths() {
    if ($this->configData) {
        return $this->configData;
    }
    // Get the root package config.
    $package_config = $this->rootPackage
        ->getExtra();
    if (isset($package_config['drupal-core-vendor-hardening'])) {
        $this->configData = array_change_key_case($package_config['drupal-core-vendor-hardening'], CASE_LOWER);
    }
    // Ensure the values are arrays.
    $this->configData = array_map(function ($paths) {
        return (array) $paths;
    }, $this->configData);
    // Merge root config with defaults.
    foreach (array_change_key_case(static::$defaultConfig, CASE_LOWER) as $package => $paths) {
        $this->configData[$package] = array_merge($this->configData[$package] ?? [], $paths);
    }
    return $this->configData;
}

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