2017-01-21 23:07:20 +01:00
|
|
|
<?php
|
|
|
|
// Some useful functions
|
|
|
|
|
|
|
|
use Engelsystem\Config\Config;
|
2017-07-18 21:38:53 +02:00
|
|
|
use Engelsystem\Http\Request;
|
2017-01-21 23:07:20 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
|
|
|
}
|
2017-07-18 21:38:53 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $key
|
|
|
|
* @param mixed $default
|
|
|
|
* @return Request|mixed
|
|
|
|
*/
|
|
|
|
function request($key = null, $default = null)
|
|
|
|
{
|
|
|
|
$request = Request::getInstance();
|
|
|
|
|
|
|
|
if (is_null($key)) {
|
|
|
|
return $request;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $request->input($key, $default);
|
|
|
|
}
|