Completed
Pull Request — develop (#57)
by Tony
12:05 queued 04:46
created
app/Settings.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,19 +70,16 @@  discard block
 block discarded – undo
70 70
                     if (is_string($k) && !str_contains($k, '.') && DbConfig::exactKey($key)->exists() && DbConfig::key($key)->count() == 1) {
71 71
                         // check that we aren't trying to set an array onto an existing value only setting
72 72
                         throw new \Exception("Attempting to set array value to existing non-array value at the key '" . $key . "'");
73
-                    }
74
-                    else {
73
+                    } else {
75 74
                         // we are not at the leaf yet, add this chunk to the key and recurse
76 75
                         $this->set($key . '.' . $k, $v);
77 76
                     }
78
-                }
79
-                else {
77
+                } else {
80 78
                     // a leaf, recurse one last time
81 79
                     $this->set($k, $v);
82 80
                 }
83 81
             }
84
-        }
85
-        else {
82
+        } else {
86 83
             // make sure we can save this
87 84
             if ($this->isReadOnly($key)) {
88 85
                 throw new \Exception("The setting '" . $key . "' is read only");
@@ -122,16 +119,14 @@  discard block
 block discarded – undo
122 119
             if (count($db_data) == 1 && $db_data->first()->config_name == $key) {
123 120
                 // return a value if we are getting one item
124 121
                 return $db_data->first()->config_value;
125
-            }
126
-            elseif (count($db_data) >= 1) {
122
+            } elseif (count($db_data) >= 1) {
127 123
                 // convert the collection to an array
128 124
                 $result = self::collectionToArray($db_data, $key);
129 125
 
130 126
                 // if we have config_data, merge them
131 127
                 if (isset($config_data)) {
132 128
                     return array_replace_recursive($result, $config_data);
133
-                }
134
-                else {
129
+                } else {
135 130
                     return $result;
136 131
                 }
137 132
             }
@@ -227,8 +222,7 @@  discard block
 block discarded – undo
227 222
         if (is_null($key)) {
228 223
             // Clear all cache
229 224
             Cache::tags(self::$cache_tag)->flush();
230
-        }
231
-        else {
225
+        } else {
232 226
             // Clear specific path
233 227
             $path = [];
234 228
             foreach (explode('.', $key) as $element) {
Please login to merge, or discard this patch.