From fdc1fddc954813082d24ad1e2f02f34468dd846d Mon Sep 17 00:00:00 2001 From: Len van Essen Date: Thu, 21 Sep 2017 21:44:41 +0200 Subject: [PATCH] Fix issue with not set configs and looping troughs nulls --- src/Config/Config.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Config/Config.php b/src/Config/Config.php index d984605..5013361 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -20,6 +20,10 @@ public function __construct($config) { parent::__construct($config); + if (!isset($config['redirects']) || ! is_array($config['redirects'])) { + $config['redirects'] = []; + } + $this->remove('redirects'); foreach ($config['redirects'] as $name => $parameters) { if (!is_array($parameters)) { @@ -29,6 +33,10 @@ public function __construct($config) } } + if (!isset($config['jits']) || ! is_array($config['jits'])) { + $config['jits'] = []; + } + $this->remove('jits'); foreach ($config['jits'] as $name => $parameters) { if (!is_array($parameters)) { @@ -86,4 +94,13 @@ public function setVariables(array $variables) { $this->set('variables', $variables); } + + /** + * Get slightly tweaked so the default response is an array + * {@inheritdoc} + */ + public function get($key, $default = null, $deep = false) + { + return parent::get($key, $default = [], $deep); + } }