Cms::mergeConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * CakeCMS Core
4
 *
5
 * This file is part of the of the simple cms based on CakePHP 3.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package     Core
10
 * @license     MIT
11
 * @copyright   MIT License http://www.opensource.org/licenses/mit-license.php
12
 * @link        https://github.com/CakeCMS/Core".
13
 * @author      Sergey Kalistratov <[email protected]>
14
 */
15
16
namespace Core;
17
18
use Cake\Utility\Hash;
19
use Cake\Core\Configure;
20
21
/**
22
 * Class Cms
23
 *
24
 * @package Core
25
 */
26
class Cms
27
{
28
29
    /**
30
     * Merge configure values by key.
31
     *
32
     * @param string $key
33
     * @param array|string $config
34
     * @return array|mixed
35
     */
36
    public static function mergeConfig($key, $config)
37
    {
38
        $values = Hash::merge((array) Configure::read($key), $config);
39
        Configure::write($key, $values);
40
41
        return $values;
42
    }
43
}
44