diff options
author | msquare <msquare@notrademark.de> | 2017-11-12 13:25:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-12 13:25:56 +0100 |
commit | ebc973bf221bfbde327868975221e62704e4cb99 (patch) | |
tree | 9011a160f3d6f9cae37fc02836e7d6e8c25242ca /src/helpers.php | |
parent | 801c17aa6cef91be988a25a90442be8d2078a70d (diff) | |
parent | ad948bdd3201e922b626a736b0122533bdd37cae (diff) |
Merge pull request #349 from MyIgel/master
Changed container to Illuminate/Container and added service providers
Diffstat (limited to 'src/helpers.php')
-rw-r--r-- | src/helpers.php | 65 |
1 files changed, 49 insertions, 16 deletions
diff --git a/src/helpers.php b/src/helpers.php index de303963..5a48498a 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -24,6 +24,15 @@ function app($id = null) } /** + * @param string $path + * @return string + */ +function base_path($path = '') +{ + return app('path') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path); +} + +/** * Get or set config values * * @param string|array $key @@ -47,6 +56,30 @@ function config($key = null, $default = null) } /** + * @param string $path + * @return string + */ +function config_path($path = '') +{ + return app('path.config') . (empty($path) ? '' : DIRECTORY_SEPARATOR . $path); +} + +/** + * @param string $key + * @param mixed $default + * @return mixed + */ +function env($key, $default = null) +{ + $value = getenv($key); + if ($value === false) { + return $default; + } + + return $value; +} + +/** * @param string $key * @param mixed $default * @return Request|mixed @@ -79,22 +112,6 @@ function session($key = null, $default = null) } /** - * @param string $template - * @param mixed[] $data - * @return Renderer|string - */ -function view($template = null, $data = null) -{ - $renderer = app('renderer'); - - if (is_null($template)) { - return $renderer; - } - - return $renderer->render($template, $data); -} - -/** * @param string $path * @param array $parameters * @return UrlGenerator|string @@ -109,3 +126,19 @@ function url($path = null, $parameters = []) return $urlGenerator->to($path, $parameters); } + +/** + * @param string $template + * @param mixed[] $data + * @return Renderer|string + */ +function view($template = null, $data = null) +{ + $renderer = app('renderer'); + + if (is_null($template)) { + return $renderer; + } + + return $renderer->render($template, $data); +} |