Skip to content

Commit

Permalink
Fixed codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonShevchuk authored and AntonShevchuk committed Feb 19, 2015
1 parent 781aa28 commit f7f409b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit f7f409b

Please sign in to comment.