HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/fabricas.colombiatrade.com.co/vendor2/consolidation/config/src/Util/ConfigMerge.php
<?php
namespace Consolidation\Config\Util;

/**
 * Works like 'getWithFallback', but merges results from all applicable
 * groups. Settings from most specific group take precedence.
 */
class ConfigMerge extends ConfigGroup
{
    /**
     * @inheritdoc
     */
    public function get($key)
    {
        return $this->getWithMerge($key, $this->group, $this->prefix, $this->postfix);
    }

    /**
     * Merge available configuration from each configuration group.
     */
    public function getWithMerge($key, $group, $prefix = '', $postfix = '.')
    {
        $configKey = "{$prefix}{$group}${postfix}{$key}";
        $result = $this->config->get($configKey, []);
        if (!is_array($result)) {
            throw new \UnexpectedValueException($configKey . ' must be a list of settings to apply.');
        }
        $moreGeneralGroupname = $this->moreGeneralGroupName($group);
        if ($moreGeneralGroupname) {
            $result += $this->getWithMerge($key, $moreGeneralGroupname, $prefix, $postfix);
        }
        return $result;
    }
}