From f7f409ba3d31018c1bfa74b7fa6a796a7e63a6f0 Mon Sep 17 00:00:00 2001 From: AntonShevchuk Date: Thu, 19 Feb 2015 18:46:07 +0200 Subject: [PATCH] Fixed codestyle --- src/Config/Config.php | 18 ++++++++++++------ src/Controller/Crud.php | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Config/Config.php b/src/Config/Config.php index 128430a1..22b46e1c 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -137,22 +137,28 @@ protected function loadFiles($path) */ public function getData($key = null, $section = null) { - if (!$this->config) { + // configuration is missed + if (is_null($this->config)) { throw new ConfigException('System configuration is missing'); } - if (!is_null($key) && isset($this->config[$key])) { - if ($section + // return all configuration + if (is_null($key)) { + return $this->config; + } + + // return part of configuration + if (isset($this->config[$key])) { + // return section of configuration + if (!is_null($section) && isset($this->config[$key][$section]) ) { return $this->config[$key][$section]; } else { return $this->config[$key]; } - } elseif (!is_null($key)) { - return null; } else { - return $this->config; + return null; } } diff --git a/src/Controller/Crud.php b/src/Controller/Crud.php index 54754e41..bde3f0eb 100644 --- a/src/Controller/Crud.php +++ b/src/Controller/Crud.php @@ -111,7 +111,7 @@ public function __invoke() */ public function getPrimaryKey() { - if (!$this->primary) { + if (is_null($this->primary)) { $primary = $this->getCrud()->getPrimaryKey(); $this->primary = array_intersect_key($this->data, array_flip($primary)); }