Completed
Push — psr2 ( 2a8f2d...cd4dd9 )
by Tony
02:56
created
app/Http/Middleware/Authenticate.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/Models/DbConfig.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/Controllers/SettingsController.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,8 @@
 block discarded – undo
76 76
         if ($type == 'settings-value') {
77 77
             Settings::set($key, Input::get('value'));
78 78
             return response('OK', 200);
79
-        } elseif ($type == 'settings-array') {
79
+        }
80
+        elseif ($type == 'settings-array') {
80 81
             $new = Input::get('value');
81 82
             $current = Settings::get($key);
82 83
 
Please login to merge, or discard this patch.
app/Api/Controllers/DashboardWidgetController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      */
74 74
     public function show(Request $request, $id)
75 75
     {
76
-        $widget  = Widgets::find($id);
76
+        $widget = Widgets::find($id);
77 77
         return array('widget' => $widget);
78 78
     }
79 79
 
Please login to merge, or discard this 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/DataTables/Scopes/DeviceGroup.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function apply($query)
23 23
     {
24
-        return $query->whereHas('groups', function ($q) {
24
+        return $query->whereHas('groups', function($q) {
25 25
             $q->where('id', '=', $this->group_id);
26 26
         });
27 27
     }
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceGroupController.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -195,7 +195,8 @@
 block discarded – undo
195 195
         $user = \Auth::user();
196 196
         if (!is_null($user) && $user->isAdmin()) {
197 197
             return false;
198
-        } else {
198
+        }
199
+        else {
199 200
             return 'auth';
200 201
         }
201 202
     }
Please login to merge, or discard this patch.
app/Models/DeviceGroup.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
         }
170 170
 
171 171
         foreach (Settings::get('alert.macros.group', []) as $macro => $value) {
172
-            $value = str_replace(['%', '&&', '||'], ['', 'AND', 'OR'], $value);  // this might need something more complex
172
+            $value = str_replace(['%', '&&', '||'], ['', 'AND', 'OR'], $value); // this might need something more complex
173 173
             if (!str_contains($macro, ' ')) {
174 174
                 $pattern = str_replace('macros.'.$macro, '('.$value.')', $pattern);
175 175
             }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         }
225 225
 
226 226
         // fill in parameters
227
-        foreach ((array)$this->params as $value) {
227
+        foreach ((array) $this->params as $value) {
228 228
             if (!is_numeric($value) && !starts_with($value, "'")) {
229 229
                 $value = "'".$value."'";
230 230
             }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         $related = $this->getRelation('deviceCountRelation')->first();
252 252
 
253 253
         // then return the count directly
254
-        return ($related) ? (int)$related->count : 0;
254
+        return ($related) ? (int) $related->count : 0;
255 255
     }
256 256
 
257 257
     /**
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -123,7 +123,8 @@  discard block
 block discarded – undo
123 123
                     // can't build sql
124 124
                     return [];
125 125
                 }
126
-            } else {
126
+            }
127
+            else {
127 128
                 $params = $this->params;
128 129
             }
129 130
         }
@@ -134,7 +135,8 @@  discard block
 block discarded – undo
134 135
         $query = null;
135 136
         if (count($tables) == 1) {
136 137
             $query = DB::table($tables[0])->select('device_id')->distinct();
137
-        } else {
138
+        }
139
+        else {
138 140
             $query = DB::table('devices')->select('devices.device_id')->distinct();
139 141
 
140 142
             foreach ($tables as $table) {
@@ -150,7 +152,8 @@  discard block
 block discarded – undo
150 152
         // match the device ids
151 153
         if (is_null($params)) {
152 154
             return $query->whereRaw($statement)->pluck('device_id');
153
-        } else {
155
+        }
156
+        else {
154 157
             return $query->whereRaw($statement, $params)->pluck('device_id');
155 158
         }
156 159
     }
@@ -178,7 +181,8 @@  discard block
 block discarded – undo
178 181
         if (str_contains($pattern, 'macros.')) {
179 182
             if (++$x < 30) {
180 183
                 $pattern = self::applyGroupMacros($pattern, $x);
181
-            } else {
184
+            }
185
+            else {
182 186
                 return false;
183 187
             }
184 188
         }
@@ -309,7 +313,8 @@  discard block
 block discarded – undo
309 313
             if (starts_with($cur, '%')) {
310 314
                 // table and column or macro
311 315
                 $out .= substr($cur, 1).' ';
312
-            } elseif (substr($cur, -1) == '~') {
316
+            }
317
+            elseif (substr($cur, -1) == '~') {
313 318
                 // like operator
314 319
                 $content = $parts[++$i]; // grab the content so we can format it
315 320
 
@@ -320,14 +325,18 @@  discard block
 block discarded – undo
320 325
 
321 326
                 $out .= "LIKE('".$this->convertRegexToLike($content)."') ";
322 327
 
323
-            } elseif ($cur == '&&') {
328
+            }
329
+            elseif ($cur == '&&') {
324 330
                 $out .= 'AND ';
325
-            } elseif ($cur == '||') {
331
+            }
332
+            elseif ($cur == '||') {
326 333
                 $out .= 'OR ';
327
-            } elseif (in_array($cur, $ops)) {
334
+            }
335
+            elseif (in_array($cur, $ops)) {
328 336
                 // pass-through operators
329 337
                 $out .= $cur.' ';
330
-            } else {
338
+            }
339
+            else {
331 340
                 // user supplied input
332 341
                 $out .= "'".trim($cur, '"\'')."' "; // TODO: remove trim, only needed with invalid input
333 342
             }
@@ -360,7 +369,8 @@  discard block
 block discarded – undo
360 369
         // add ends appropriately
361 370
         if ($startAnchor && !$endAnchor) {
362 371
             $pattern .= '%';
363
-        } elseif (!$startAnchor && $endAnchor) {
372
+        }
373
+        elseif (!$startAnchor && $endAnchor) {
364 374
             $pattern = '%'.$pattern;
365 375
         }
366 376
 
Please login to merge, or discard this patch.
app/Providers/RouteServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         Route::group([
55 55
             'middleware' => 'web',
56 56
             'namespace' => $this->namespace,
57
-        ], function ($router) {
57
+        ], function($router) {
58 58
             require base_path('routes/web.php');
59 59
         });
60 60
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             'middleware' => ['api', 'jwt-auth'],
73 73
             'namespace' => $this->namespace,
74 74
             'prefix' => 'api',
75
-        ], function ($router) {
75
+        ], function($router) {
76 76
             require base_path('routes/api.php');
77 77
         });
78 78
     }
Please login to merge, or discard this patch.
app/Providers/BroadcastServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         /*
20 20
          * Authenticate the user's personal channel...
21 21
          */
22
-        Broadcast::channel('App.User.*', function ($user, $userId) {
22
+        Broadcast::channel('App.User.*', function($user, $userId) {
23 23
             return (int) $user->id === (int) $userId;
24 24
         });
25 25
     }
Please login to merge, or discard this patch.