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\ConfigCode
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);
}