|
|
@ -126,18 +126,22 @@ class JsonManipulator
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$decoded = JsonFile::parseJson($this->contents);
|
|
|
|
$decoded = JsonFile::parseJson($this->contents);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$subName = null;
|
|
|
|
|
|
|
|
if (in_array($mainNode, array('config', 'repositories')) && false !== strpos($name, '.')) {
|
|
|
|
|
|
|
|
list($name, $subName) = explode('.', $name, 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// no main node yet
|
|
|
|
// no main node yet
|
|
|
|
if (!isset($decoded[$mainNode])) {
|
|
|
|
if (!isset($decoded[$mainNode])) {
|
|
|
|
$this->addMainKey($mainNode, array($name => $value));
|
|
|
|
if ($subName !== null) {
|
|
|
|
|
|
|
|
$this->addMainKey($mainNode, array($name => array($subName => $value)));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$this->addMainKey($mainNode, array($name => $value));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$subName = null;
|
|
|
|
|
|
|
|
if (in_array($mainNode, array('config', 'repositories')) && false !== strpos($name, '.')) {
|
|
|
|
|
|
|
|
list($name, $subName) = explode('.', $name, 2);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// main node content not match-able
|
|
|
|
// main node content not match-able
|
|
|
|
$nodeRegex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
|
|
|
|
$nodeRegex = '{^(\s*\{\s*(?:'.self::$JSON_STRING.'\s*:\s*'.self::$JSON_VALUE.'\s*,\s*)*?)'.
|
|
|
|
'('.preg_quote(JsonFile::encode($mainNode)).'\s*:\s*\{)('.self::$RECURSE_BLOCKS.')(\})(.*)}s';
|
|
|
|
'('.preg_quote(JsonFile::encode($mainNode)).'\s*:\s*\{)('.self::$RECURSE_BLOCKS.')(\})(.*)}s';
|
|
|
|