public function mergeDefinitionsDB(array $settingsArray, array &$definitions, $applyDefaults = false, $path = 'defaults') { if ($path !== null) { $definitionsPaths = ArrayTools::TraverseTree($settingsArray, $path); //var_dump($settingsArray); // $mergeNotReplace = ArrayTools::TraverseTree($settingsArray, 'custom'); //var_dump($mergeNotReplace); } else { // TODO } /* if($mergeNotReplace) { foreach($mergeNotReplace as $mergePath) { LogCLI::MessageResult('Merging definitions in storage: '.LogCLI::BLUE.$mergePath.LogCLI::RESET, 5, LogCLI::INFO); var_dump(ArrayTools::accessArrayElementByPath($settingsArray, $mergePath)); var_dump($definitions); // let's copy all the definitions and merge them, overriding any previously set settings in this instance ArrayTools::mergeArrayElementByPath(&$definitions, $mergePath, ArrayTools::accessArrayElementByPath($settingsArray, $mergePath), 0, true); // no override var_dump($definitions); } } */ if ($definitionsPaths) { foreach ($definitionsPaths as $definitionsPath) { LogCLI::MessageResult('Copying to definitions storage: ' . LogCLI::BLUE . $definitionsPath . LogCLI::RESET, 5, LogCLI::INFO); // let's copy all the definitions and merge them, overriding any previously set settings in this instance ArrayTools::mergeArrayElementByPath($definitions, $definitionsPath, ArrayTools::accessArrayElementByPath($settingsArray, $definitionsPath), 0); // remove the defaults, they are not needed anymore, we have them in a separated array $this->removeByPath($definitionsPath); // optionally apply them to all elements if ($applyDefaults === true) { $this->applyDefaults($this->DB, $definitions, $definitionsPath, $path, false, true); } } } }
public function returnSettingsList($scope = false) { $this->listSettings($scope); //var_dump($this->settingsList); //var_dump($this->pathsList); $settingsInPaths = array(); foreach ($this->pathsList as $path) { $scope = StringTools::ReturnLastBit($path); if (isset($this->settingsList[$scope])) { ArrayTools::mergeArrayElementByPath($settingsInPaths, $path, $this->settingsList[$scope]); //var_dump($this->settingsList[$scope]); } else { LogCLI::Warning('The specification for the stem ' . LogCLI::GREEN . $scope . LogCLI::YELLOW . ' is missing in the parser class.'); //ArrayTools::mergeArrayElementByPath(&$settingsInPaths, $path, $this->settingsList); } } //var_dump($settingsInPaths); return $settingsInPaths; //return $this->settingsList; //return ArrayTools::GetMultiDimentionalElements(); }