Completed
Push — psr2 ( d57791 )
by Tony
09:39
created
app/Api/Controllers/DeviceController.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,8 @@  discard block
 block discarded – undo
23 23
         $per_page = $request->per_page ?: 25;
24 24
         if ($request->user()->hasGlobalRead()) {
25 25
             $devices = Device::paginate($per_page);
26
-        } else {
26
+        }
27
+        else {
27 28
             $devices = User::find($request->user()->user_id)->devices()->paginate($per_page);
28 29
         }
29 30
         return $devices;
@@ -60,7 +61,8 @@  discard block
 block discarded – undo
60 61
     {
61 62
         if ($request->user()->hasGlobalRead()) {
62 63
             $device = Device::find($id);
63
-        } else {
64
+        }
65
+        else {
64 66
             $user = User::find($request->user()->user_id);
65 67
             $device = $user->devices()->find($id);
66 68
         }
Please login to merge, or discard this patch.
app/Settings.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -70,16 +70,19 @@  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
-                    } else {
73
+                    }
74
+                    else {
74 75
                         // we are not at the leaf yet, add this chunk to the key and recurse
75 76
                         $this->set($key.'.'.$k, $v);
76 77
                     }
77
-                } else {
78
+                }
79
+                else {
78 80
                     // a leaf, recurse one last time
79 81
                     $this->set($k, $v);
80 82
                 }
81 83
             }
82
-        } else {
84
+        }
85
+        else {
83 86
             // make sure we can save this
84 87
             if ($this->isReadOnly($key)) {
85 88
                 throw new \Exception("The setting '".$key."' is read only");
@@ -112,14 +115,16 @@  discard block
 block discarded – undo
112 115
             if (count($db_data) == 1 && $db_data->first()->config_name == $key && $is_array !== true) {
113 116
                 // return a value if we are getting one item and it is the requested item (not recursing)
114 117
                 return $db_data->first()->config_value;
115
-            } elseif (count($db_data) >= 1) {
118
+            }
119
+            elseif (count($db_data) >= 1) {
116 120
                 // convert the collection to an array
117 121
                 $result = self::collectionToArray($db_data, $key);
118 122
 
119 123
                 // if we have config_data, merge them
120 124
                 if (isset($config_data)) {
121 125
                     return array_replace_recursive($config_data, $result);
122
-                } else {
126
+                }
127
+                else {
123 128
                     return $result;
124 129
                 }
125 130
             }
@@ -201,7 +206,8 @@  discard block
 block discarded – undo
201 206
         $count = DbConfig::key($key)->count();
202 207
         if ($count == 1) {
203 208
             $this->flush($key);
204
-        } else {
209
+        }
210
+        else {
205 211
             $this->flush(); // possible optimization: selective flush
206 212
         }
207 213
 
@@ -235,7 +241,8 @@  discard block
 block discarded – undo
235 241
         if (is_null($key)) {
236 242
             // Clear all cache
237 243
             Cache::tags(self::$cache_tag)->flush();
238
-        } else {
244
+        }
245
+        else {
239 246
             // Clear specific path
240 247
             $path = [];
241 248
             foreach (explode('.', $key) as $element) {
@@ -260,7 +267,8 @@  discard block
 block discarded – undo
260 267
             $this->forget($key);
261 268
             array_unshift($var, $value);
262 269
             $this->set($key, $var);
263
-        } else {
270
+        }
271
+        else {
264 272
             $arr = [$value];
265 273
             if (!is_null($var)) {
266 274
                 $arr[] = $var;
@@ -284,7 +292,8 @@  discard block
 block discarded – undo
284 292
         if (is_array($var)) {
285 293
             $var[] = $value;
286 294
             $this->set($key, $var);
287
-        } else {
295
+        }
296
+        else {
288 297
             $arr = array();
289 298
             if (!is_null($var)) {
290 299
                 $arr[] = $var;
Please login to merge, or discard this patch.
app/Util.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,8 @@
 block discarded – undo
102 102
             } catch(\Exception $e) {
103 103
                 if(starts_with($e->getMessage(), 'unserialize():')) {
104 104
                     return $value;
105
-                } else {
105
+                }
106
+                else {
106 107
                     throw $e;
107 108
                 }
108 109
             }
Please login to merge, or discard this patch.
app/Http/Middleware/Access.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
         if (Auth::guard($guard)->guest()) {
21 21
             if ($request->ajax() || $request->wantsJson()) {
22 22
                 return response('Unauthorized.', 401);
23
-            } else {
23
+            }
24
+            else {
24 25
                 return redirect()->guest('login');
25 26
             }
26 27
         }
Please login to merge, or discard this patch.
app/Http/Middleware/AdminOnly.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,8 @@
 block discarded – undo
20 20
         if (Auth::guard($guard)->guest()) {
21 21
             if ($request->ajax() || $request->wantsJson()) {
22 22
                 return response('Unauthorized.', 401);
23
-            } else {
23
+            }
24
+            else {
24 25
                 return redirect()->guest('login');
25 26
             }
26 27
         }
Please login to merge, or discard this patch.
app/Console/Commands/AddUser.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,14 +54,16 @@  discard block
 block discarded – undo
54 54
         // set realname
55 55
         if ($this->option('realname')) {
56 56
             $user->realname = $this->option('realname');
57
-        } else {
57
+        }
58
+        else {
58 59
             $user->realname = $this->ask('Real Name');
59 60
         }
60 61
 
61 62
         // set email
62 63
         if ($this->option('email')) {
63 64
             $user->email = $this->option('email');
64
-        } else {
65
+        }
66
+        else {
65 67
             $user->email = $this->ask('Email');
66 68
         }
67 69
 
@@ -77,14 +79,16 @@  discard block
 block discarded – undo
77 79
         // set password
78 80
         if ($this->argument('password')) {
79 81
             $user->password = $this->argument('password');
80
-        } else {
82
+        }
83
+        else {
81 84
             $user->password = $this->secret('Password');
82 85
         }
83 86
 
84 87
         // save user
85 88
         if ($user->save()) {
86 89
             $this->info('User '.$user->username.' created.');
87
-        } else {
90
+        }
91
+        else {
88 92
             $this->error('Failed to create user '.$user->username);
89 93
         }
90 94
     }
Please login to merge, or discard this patch.
app/Models/Device.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -197,7 +197,8 @@  discard block
 block discarded – undo
197 197
         $icon = $this->icon;
198 198
         if (isset($icon)) {
199 199
             return asset('images/os/'.$icon.'.png');
200
-        } else {
200
+        }
201
+        else {
201 202
             return asset('images/os/generic.png');
202 203
         }
203 204
     }
@@ -212,11 +213,14 @@  discard block
 block discarded – undo
212 213
         $disabled = $this->disabled;
213 214
         if ($disabled == 1) {
214 215
             return 'teal';
215
-        } elseif ($ignore == 1) {
216
+        }
217
+        elseif ($ignore == 1) {
216 218
             return 'yellow';
217
-        } elseif ($status == 0) {
219
+        }
220
+        elseif ($status == 0) {
218 221
             return 'danger';
219
-        } else {
222
+        }
223
+        else {
220 224
             return 'success';
221 225
         }
222 226
     }
Please login to merge, or discard this patch.
app/DataTables/Alerting/LogsDataTable.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@  discard block
 block discarded – undo
46 46
             ->editColumn('rule.name', function ($log) {
47 47
                 if ($log->rule_id) {
48 48
                     return '<a href="'.url("alerting/rules/".$log->rule_id).'">'.$log->rule->name.'</a>';
49
-                } else {
49
+                }
50
+                else {
50 51
                     return trans('alerting.general.text.invalid');
51 52
                 }
52 53
             })
@@ -58,19 +59,23 @@  discard block
 block discarded – undo
58 59
                     $icon   = 'check';
59 60
                     $colour = 'green';
60 61
                     $text   = trans('alerting.logs.text.ok');
61
-                } elseif ($log->state == 1) {
62
+                }
63
+                elseif ($log->state == 1) {
62 64
                     $icon   = 'times';
63 65
                     $colour = 'red';
64 66
                     $text   = trans('alerting.logs.text.fail');
65
-                } elseif ($log->state == 2) {
67
+                }
68
+                elseif ($log->state == 2) {
66 69
                     $icon   = 'volume-off';
67 70
                     $colour = 'lightgrey';
68 71
                     $text   = trans('alerting.logs.text.ack');
69
-                } elseif ($log->state == 3) {
72
+                }
73
+                elseif ($log->state == 3) {
70 74
                     $icon   = 'arrow-down';
71 75
                     $colour = 'orange';
72 76
                     $text   = trans('alerting.logs.text.worse');
73
-                } elseif ($log->state == 4) {
77
+                }
78
+                elseif ($log->state == 4) {
74 79
                     $icon   = 'arrow-up';
75 80
                     $colour = 'khaki';
76 81
                     $text   = trans('alerting.logs.text.better');
Please login to merge, or discard this patch.
app/DataTables/Alerting/AlertsDataTable.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,8 @@
 block discarded – undo
102 102
             } catch(\Exception $e) {
103 103
                 if(starts_with($e->getMessage(), 'unserialize():')) {
104 104
                     return $value;
105
-                } else {
105
+                }
106
+                else {
106 107
                     throw $e;
107 108
                 }
108 109
             }
Please login to merge, or discard this patch.