private static function mergeSettings(array $a, array $b, $mergeArrays = false): array
    {
        foreach ($b as $key => $value) {
            if (array_key_exists($key, $a)) {
                if (self::isAssoc($a[$key]) && self::isAssoc($b[$key])) {
                    $a[$key] = self::mergeSettings(
                        $a[$key],
                        $b[$key],
                        $mergeArrays
                    );
                } elseif ($mergeArrays && is_array($a[$key]) && is_array($b[$key])) {
                    $a[$key] = array_values(array_unique(array_merge($a[$key], $b[$key])));
                } else {
                    $a[$key] = $b[$key];
                }
            } else {
                $a[$key] = $value;
            }
        }

        return $a;
    }