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

Breadcrumb

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

function JsonConfigSource::addProperty

@inheritDoc

Overrides ConfigSourceInterface::addProperty

File

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

Class

JsonConfigSource
JSON Configuration Source

Namespace

Composer\Config

Code

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

API Navigation

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