summaryrefslogtreecommitdiff
path: root/src/helpers.php
blob: aeb256e9e2c6d3d7088765ea191bd36a2d9c3f0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// Some useful functions

use Engelsystem\Config\Config;

/**
 * Get or set config values
 *
 * @param string|array $key
 * @param mixed        $default
 * @return mixed|Config
 */
function config($key = null, $default = null)
{
    if (empty($key)) {
        return Config::getInstance();
    }

    if (is_array($key)) {
        Config::getInstance()->set($key);
    }

    return Config::getInstance()->get($key, $default);
}