Skip to content

Commit

Permalink
add some cosnt, add global func config()
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed May 3, 2018
1 parent abf3d9e commit 0d8bb66
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Bootstrap/Server/ServerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
*/
interface ServerInterface
{
// there are main server type
const TYPE_HTTP = 'http';
const TYPE_RPC = 'rpc';
const TYPE_TCP = 'tcp';
const TYPE_WS = 'ws';

/**
* Start
*/
Expand Down
15 changes: 15 additions & 0 deletions src/Helper/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,21 @@ function bean($name)
}
}

if (! function_exists('config')) {
/**
* Get config value from app config
*
* @param string $key
* @param null|mixed $default
* @return mixed
*/
function config(string $key, $default = null)
{
/** @see \Swoft\Core\Config::get() */
return \Swoft\App::getBean('config')->get($key, $default);
}
}

if (! function_exists('alias')) {
/**
* Get alias
Expand Down

0 comments on commit 0d8bb66

Please sign in to comment.