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

Breadcrumb

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

function JsonConfigSource::removeProperty

@inheritDoc

Overrides ConfigSourceInterface::removeProperty

File

vendor/composer/composer/src/Composer/Config/JsonConfigSource.php, line 162

Class

JsonConfigSource
JSON Configuration Source

Namespace

Composer\Config

Code

public function removeProperty(string $name) : void {
    $this->manipulateJson('removeProperty', static function (&$config, $key) : void {
        if (strpos($key, 'extra.') === 0 || strpos($key, 'scripts.') === 0 || stripos($key, 'autoload.') === 0 || stripos($key, 'autoload-dev.') === 0) {
            $bits = explode('.', $key);
            $last = array_pop($bits);
            $arr =& $config[reset($bits)];
            foreach ($bits as $bit) {
                if (!isset($arr[$bit])) {
                    return;
                }
                $arr =& $arr[$bit];
            }
            unset($arr[$last]);
        }
        else {
            unset($config[$key]);
        }
    }, $name);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal