Add mergeConfig helper, useful for extension

Refs 8575ece07d
This commit is contained in:
Samuel Georges 2017-04-17 09:55:50 +10:00
parent 27062ddfa0
commit 96d0ce1c20

View File

@ -183,4 +183,20 @@ trait ConfigMaker
$guessedPath = $classFile ? $classFile . '/' . $classFolder . $suffix : null;
return $guessedPath;
}
/**
* Merges two configuration sources, either prepared or not, and returns
* them as a single configuration object.
* @param mixed $configA
* @param mixed $configB
* @return stdClass The config object
*/
public function mergeConfig($configA, $configB)
{
$configA = $this->makeConfig($configA);
$configB = $this->makeConfig($configB);
return (object) array_merge((array) $configA, (array) $configB);
}
}