class Config

Same name in this branch
  1. 10 core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php \Drupal\migrate_drupal\Plugin\migrate\source\d8\Config
  2. 10 core/modules/migrate/src/Plugin/migrate/destination/Config.php \Drupal\migrate\Plugin\migrate\destination\Config
  3. 10 core/lib/Drupal/Core/Config/Config.php \Drupal\Core\Config\Config
Same name in other branches
  1. 9 composer/Plugin/VendorHardening/Config.php \Drupal\Composer\Plugin\VendorHardening\Config
  2. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php \Drupal\migrate_drupal\Plugin\migrate\source\d8\Config
  3. 9 core/modules/migrate/src/Plugin/migrate/destination/Config.php \Drupal\migrate\Plugin\migrate\destination\Config
  4. 9 core/lib/Drupal/Core/Config/Config.php \Drupal\Core\Config\Config
  5. 8.9.x composer/Plugin/VendorHardening/Config.php \Drupal\Composer\Plugin\VendorHardening\Config
  6. 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php \Drupal\migrate_drupal\Plugin\migrate\source\d8\Config
  7. 8.9.x core/modules/migrate/src/Plugin/migrate/destination/Config.php \Drupal\migrate\Plugin\migrate\destination\Config
  8. 8.9.x core/lib/Drupal/Core/Config/Config.php \Drupal\Core\Config\Config
  9. 11.x composer/Plugin/VendorHardening/Config.php \Drupal\Composer\Plugin\VendorHardening\Config
  10. 11.x core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php \Drupal\migrate_drupal\Plugin\migrate\source\d8\Config
  11. 11.x core/modules/migrate/src/Plugin/migrate/destination/Config.php \Drupal\migrate\Plugin\migrate\destination\Config
  12. 11.x core/lib/Drupal/Core/Config/Config.php \Drupal\Core\Config\Config

Determine configuration.

Default configuration is merged with the root package's extra:drupal-core-vendor-hardening configuration.

@internal

Hierarchy

  • class \Drupal\Composer\Plugin\VendorHardening\Config

Expanded class hierarchy of Config

3 files declare their use of Config
ComposerIntegrationTest.php in core/tests/Drupal/Tests/ComposerIntegrationTest.php
ConfigTest.php in core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/ConfigTest.php
VendorHardeningPluginTest.php in core/tests/Drupal/Tests/Composer/Plugin/VendorHardening/VendorHardeningPluginTest.php
139 string references to 'Config'
action_settings.yml in core/modules/system/migrations/action_settings.yml
core/modules/system/migrations/action_settings.yml
book_settings.yml in core/modules/book/migrations/book_settings.yml
core/modules/book/migrations/book_settings.yml
BootstrapConfigStorageFactory::getDatabaseStorage in core/lib/Drupal/Core/Config/BootstrapConfigStorageFactory.php
Returns a Database configuration storage implementation.
CachedStorageTest::setUp in core/tests/Drupal/KernelTests/Core/Config/Storage/CachedStorageTest.php
ChangeUserRoleBase::calculateDependencies in core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php
Calculates dependencies for the configured plugin.

... See full list

File

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

Namespace

Drupal\Composer\Plugin\VendorHardening
View source
class Config {
    
    /**
     * The default configuration which will always be merged with user config.
     *
     * @var array
     */
    protected static $defaultConfig = [
        'behat/mink' => [
            'tests',
        ],
        'behat/mink-browserkit-driver' => [
            'tests',
        ],
        'composer/composer' => [
            'bin',
        ],
        'drupal/coder' => [
            'coder_sniffer/Drupal/Test',
            'coder_sniffer/DrupalPractice/Test',
        ],
        'doctrine/instantiator' => [
            'tests',
        ],
        'egulias/email-validator' => [
            'documentation',
            'tests',
        ],
        'guzzlehttp/promises' => [
            'tests',
        ],
        'guzzlehttp/psr7' => [
            'tests',
        ],
        'justinrainbow/json-schema' => [
            'demo',
        ],
        'lullabot/mink-selenium2-driver' => [
            'tests',
        ],
        'lullabot/php-webdriver' => [
            'doc',
            'test',
        ],
        'masterminds/html5' => [
            'bin',
            'test',
        ],
        'mck89/peast' => [
            'doc',
        ],
        'mikey179/vfsstream' => [
            'src/test',
        ],
        'myclabs/deep-copy' => [
            'doc',
        ],
        'pear/archive_tar' => [
            'docs',
            'tests',
        ],
        'pear/console_getopt' => [
            'tests',
        ],
        'pear/pear-core-minimal' => [
            'tests',
        ],
        'pear/pear_exception' => [
            'tests',
        ],
        'phar-io/manifest' => [
            'examples',
            'tests',
        ],
        'phar-io/version' => [
            'tests',
        ],
        'phpdocumentor/reflection-docblock' => [
            'tests',
        ],
        'phpspec/prophecy' => [
            'fixtures',
            'spec',
            'tests',
        ],
        'phpunit/php-code-coverage' => [
            'tests',
        ],
        'phpunit/php-timer' => [
            'tests',
        ],
        'phpunit/phpunit' => [
            'tests',
        ],
        'sebastian/code-unit-reverse-lookup' => [
            'tests',
        ],
        'sebastian/comparator' => [
            'tests',
        ],
        'sebastian/diff' => [
            'tests',
        ],
        'sebastian/environment' => [
            'tests',
        ],
        'sebastian/exporter' => [
            'tests',
        ],
        'sebastian/global-state' => [
            'tests',
        ],
        'sebastian/object-enumerator' => [
            'tests',
        ],
        'sebastian/object-reflector' => [
            'tests',
        ],
        'sebastian/recursion-context' => [
            'tests',
        ],
        'seld/jsonlint' => [
            'tests',
        ],
        'squizlabs/php_codesniffer' => [
            'tests',
        ],
        'symfony/browser-kit' => [
            'Tests',
        ],
        'symfony/console' => [
            'Tests',
        ],
        'symfony/css-selector' => [
            'Tests',
        ],
        'symfony/dependency-injection' => [
            'Tests',
        ],
        'symfony/dom-crawler' => [
            'Tests',
        ],
        'symfony/filesystem' => [
            'Tests',
        ],
        'symfony/finder' => [
            'Tests',
        ],
        'symfony/event-dispatcher' => [
            'Tests',
        ],
        'symfony/http-foundation' => [
            'Tests',
        ],
        'symfony/http-kernel' => [
            'Tests',
        ],
        'symfony/phpunit-bridge' => [
            'Tests',
        ],
        'symfony/process' => [
            'Tests',
        ],
        'symfony/psr-http-message-bridge' => [
            'Tests',
        ],
        'symfony/routing' => [
            'Tests',
        ],
        'symfony/serializer' => [
            'Tests',
        ],
        'symfony/var-dumper' => [
            'Tests',
        ],
        'symfony/validator' => [
            'Tests',
            'Resources',
        ],
        'symfony/yaml' => [
            'Tests',
        ],
        'theseer/tokenizer' => [
            'tests',
        ],
        'twig/twig' => [
            'doc',
            'ext',
            'test',
            'tests',
        ],
    ];
    
    /**
     * The root package.
     *
     * @var \Composer\Package\RootPackageInterface
     */
    protected $rootPackage;
    
    /**
     * Configuration gleaned from the root package.
     *
     * @var array
     */
    protected $configData = [];
    
    /**
     * Construct a Config object.
     *
     * @param \Composer\Package\RootPackageInterface $root_package
     *   Composer package object for the root package.
     */
    public function __construct(RootPackageInterface $root_package) {
        $this->rootPackage = $root_package;
    }
    
    /**
     * Gets the configured list of directories to remove from the root package.
     *
     * This is stored in composer.json extra:drupal-core-vendor-hardening.
     *
     * @return array[]
     *   An array keyed by package name. Each array value is an array of paths,
     *   relative to the package.
     */
    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;
    }
    
    /**
     * Get a list of paths to remove for the given package.
     *
     * @param string $package
     *   The package name.
     *
     * @return string[]
     *   Array of paths to remove, relative to the package.
     */
    public function getPathsForPackage($package) {
        $package = strtolower($package);
        $paths = $this->getAllCleanupPaths();
        return $paths[$package] ?? [];
    }

}

Members

Title Sort descending Modifiers Object type Summary
Config::$configData protected property Configuration gleaned from the root package.
Config::$defaultConfig protected static property The default configuration which will always be merged with user config.
Config::$rootPackage protected property The root package.
Config::getAllCleanupPaths public function Gets the configured list of directories to remove from the root package.
Config::getPathsForPackage public function Get a list of paths to remove for the given package.
Config::__construct public function Construct a Config object.

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