From c4c33dfa333c30cfaf07d193612506f3daab2f6e Mon Sep 17 00:00:00 2001 From: Ferran Martinez Date: Fri, 29 Jul 2016 10:57:03 +0200 Subject: [PATCH] add getter to default environement --- src/Config/Config.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Config/Config.php b/src/Config/Config.php index 1872ad8..f95f723 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -25,6 +25,12 @@ public function get($name) if (isset($this->configs[$name])) { return $this->configs[$name]; } elseif (strpos($name, '.') !== false) { + + if (substr($name, 0, strlen('environment.')) == 'environment.') { + $name = str_replace('environment.', 'environments.' . $this->get('environment') . '.', $name); + return $this->get($name); + } + $loc = &$this->configs; foreach (explode('.', $name) as $part) { $loc = &$loc[$part]; @@ -100,6 +106,7 @@ public function shutdownFunction() $this->handleError->parseError($errortypes[$error['type']], $error['type'], $error['message'], $error['file'], $error['line']); + } }