@@ -36,8 +36,9 @@ discard block |
||
| 36 | 36 | 'people' => $people, |
| 37 | 37 | 'configKey' => $key |
| 38 | 38 | ]); |
| 39 | - if ($config) |
|
| 40 | - return $config; |
|
| 39 | + if ($config) { |
|
| 40 | + return $config; |
|
| 41 | + } |
|
| 41 | 42 | if ($create) { |
| 42 | 43 | $config = new Config(); |
| 43 | 44 | $config->setConfigKey($key); |
@@ -55,14 +56,16 @@ discard block |
||
| 55 | 56 | ) { |
| 56 | 57 | $config = $this->discoveryConfig($people, $key); |
| 57 | 58 | $newValue = json_decode($config->getConfigValue(), true) || []; |
| 58 | - if (!is_array($newValue)) |
|
| 59 | - $newValue = [$newValue]; |
|
| 59 | + if (!is_array($newValue)) { |
|
| 60 | + $newValue = [$newValue]; |
|
| 61 | + } |
|
| 60 | 62 | |
| 61 | - if (is_array($values)) |
|
| 62 | - foreach ($values as $key => $value) |
|
| 63 | + if (is_array($values)) { |
|
| 64 | + foreach ($values as $key => $value) |
|
| 63 | 65 | $newValue[$key] = $value; |
| 64 | - else |
|
| 65 | - $newValue[] = $values; |
|
| 66 | + } else { |
|
| 67 | + $newValue[] = $values; |
|
| 68 | + } |
|
| 66 | 69 | |
| 67 | 70 | $config->setConfigValue(json_encode($newValue)); |
| 68 | 71 | $config->setVisibility($visibility); |