diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2017-09-22 14:02:02 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-09-22 14:13:19 +0200 |
commit | d49e49c364c1b73e4e4e3b52dc10ee9d0150e447 (patch) | |
tree | fd61f2d661638d4fe973b522d0fca8d5d318f7dc /src/helpers.php | |
parent | 783c58611ada88460ba670d51ebf4013563e1197 (diff) |
Implemented service provider functionality
Diffstat (limited to 'src/helpers.php')
-rw-r--r-- | src/helpers.php | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/src/helpers.php b/src/helpers.php index de303963..c3c727ec 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,15 @@ 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 Request|mixed @@ -79,22 +97,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 +111,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); +} |