src/Composer/Config/JsonConfigSource.php
public function addProperty($name, $value)
    {
        $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
            if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
                $bits = explode('.', $key);
                $last = array_pop($bits);
                $arr = &$config[reset($bits)];
                foreach ($bits as $bit) {
                    if (!isset($arr[$bit])) {
                        $arr[$bit] = array();
                    }
                    $arr = &$arr[$bit];
                }
                $arr[$last] = $val;
            } else {
                $config[$key] = $val;
            }
        });
    }
public function addProperty($name, $value)
    {
        $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
            if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
                $bits = explode('.', $key);
                $last = array_pop($bits);
                $arr = &$config[reset($bits)];
                foreach ($bits as $bit) {
                    if (!isset($arr[$bit])) {
                        $arr[$bit] = array();
                    }
                    $arr = &$arr[$bit];
                }
                $arr[$last] = $val;
            } else {
                $config[$key] = $val;
            }
        });
    }
public function addProperty ( $ name , $ value ) { $ this -> manipulateJson ( 'addProperty' , $ name , $ value , function ( & $ config , $ key , $ val ) { if ( substr ( $ key , 0 , 6 ) === 'extra.' || substr ( $ key , 0 , 8 ) === 'scripts.' ) { $ bits = explode ( '.' , $ key ) ; $ last = array_pop ( $ bits ) ; $ arr = & $ config [ reset ( $ bits ) ] ; foreach ( $ bits as $ bit ) { if ( ! isset ( $ arr [ $ bit ] ) ) { $ arr [ $ bit ] = array ( ) ; } $ arr = & $ arr [ $ bit ] ; } $ arr [ $ last ] = $ val ; } else { $ config [ $ key ] = $ val ; } } ) ; }
{@inheritdoc}
{