for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Northwoods\Config;
class MergedConfigCollection extends ConfigCollection
{
/**
* @param string $dotPath
* @param string $default
*
* @return mixed|null
*/
public function get($dotPath, $default = null)
$found = null;
foreach (array_reverse($this->configs) as $config) {
/** @var ConfigInterface $config */
$value = $config->get($dotPath, null);
if ($value === null) {
continue;
}
if (is_array($found) && is_array($value)) {
$found = array_replace_recursive($found, $value);
} else {
$found = $value;
return $found !== null ? $found : $default;