Completed
Pull Request — develop (#143)
by Tony
04:52
created
app/Http/Controllers/General/SearchController.php 1 patch
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@
 block discarded – undo
25 25
 
26 26
 namespace App\Http\Controllers\General;
27 27
 
28
+use App\DataTables\General\ArpDataTable;
28 29
 use App\DataTables\General\IPv4DataTable;
29 30
 use App\DataTables\General\IPv6DataTable;
30 31
 use App\DataTables\General\MacDataTable;
31
-use App\DataTables\General\ArpDataTable;
32 32
 use App\Http\Controllers\Controller;
33 33
 use Illuminate\Http\Request;
34 34
 
Please login to merge, or discard this patch.
app/Http/Controllers/Widgets/WidgetDataController.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
         $uptime = Settings::get('uptime_warning', 84600);
83 83
         if ($request->user()->hasGlobalRead()) {
84 84
             $devices = Device::where('ignore', '=', 0)->get();
85
-        } else {
85
+        }
86
+        else {
86 87
             $devices = User::find($request->user()->user_id)->devices()->where('ignore', '=', 0)->get();
87 88
         }
88 89
         $count = ['warn' => 0, 'up' => 0, 'down' => 0];
@@ -90,10 +91,12 @@  discard block
 block discarded – undo
90 91
             if ($device->status == 1) {
91 92
                 if (($device->uptime < $uptime) && ($device->uptime != '0')) {
92 93
                     $count['warn']++;
93
-                } else {
94
+                }
95
+                else {
94 96
                     $count['up']++;
95 97
                 }
96
-            } else {
98
+            }
99
+            else {
97 100
                 $count['down']++;
98 101
             }
99 102
         }
@@ -122,7 +125,8 @@  discard block
 block discarded – undo
122 125
             $count['ports']['down'] = Port::isDown()->count();
123 126
             $count['ports']['ignored'] = Port::isIgnored()->count();
124 127
             $count['ports']['disabled'] = Port::isDisabled()->count();
125
-        } else {
128
+        }
129
+        else {
126 130
             $user = User::find($request->user()->user_id);
127 131
 
128 132
             $count['devices']['total'] = $user->devices()->count();
Please login to merge, or discard this patch.
app/DataTables/DeviceDataTable.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
 
26 26
 namespace App\DataTables;
27 27
 
28
-use App\Models\DeviceGroup;
29 28
 use App\Models\Device;
30 29
 
31 30
 class DeviceDataTable extends BaseDataTable
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceController.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Http\Controllers;
4 4
 
5 5
 use App\DataTables\DeviceDataTable;
6
-use App\DataTables\DeviceGroupDataTable;
7 6
 use App\Models\DeviceGroup;
8 7
 use Dingo\Api\Http;
9 8
 use Dingo\Api\Routing\Helpers;
Please login to merge, or discard this patch.
app/Http/Controllers/DeviceGroupController.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Api\Controllers;
4 4
 
5 5
 use DB;
6
-use App\Http\Requests;
7 6
 use Illuminate\Http\Request;
8 7
 
9 8
 class ApiController extends Controller
Please login to merge, or discard this 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 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -97,7 +97,8 @@  discard block
 block discarded – undo
97 97
         $query = null;
98 98
         if (count($tables) == 1) {
99 99
             $query = DB::table($tables[0])->select('device_id')->distinct();
100
-        } else {
100
+        }
101
+        else {
101 102
             $query = DB::table('devices')->select('devices.device_id')->distinct();
102 103
 
103 104
             foreach ($tables as $table) {
@@ -136,7 +137,8 @@  discard block
 block discarded – undo
136 137
             if (starts_with($cur, '%')) {
137 138
                 // table and column or macro
138 139
                 $out .= substr($cur, 1).' ';
139
-            } elseif (substr($cur, -1) == '~') {
140
+            }
141
+            elseif (substr($cur, -1) == '~') {
140 142
                 // like operator
141 143
                 $content = $parts[++$i]; // grab the content so we can format it
142 144
 
@@ -147,14 +149,18 @@  discard block
 block discarded – undo
147 149
 
148 150
                 $out .= "LIKE('".$this->convertRegexToLike($content)."') ";
149 151
 
150
-            } elseif ($cur == '&&') {
152
+            }
153
+            elseif ($cur == '&&') {
151 154
                 $out .= 'AND ';
152
-            } elseif ($cur == '||') {
155
+            }
156
+            elseif ($cur == '||') {
153 157
                 $out .= 'OR ';
154
-            } elseif (in_array($cur, $ops)) {
158
+            }
159
+            elseif (in_array($cur, $ops)) {
155 160
                 // pass-through operators
156 161
                 $out .= $cur.' ';
157
-            } else {
162
+            }
163
+            else {
158 164
                 // user supplied input
159 165
                 $out .= "'".trim($cur, '"\'')."' "; // TODO: remove trim, only needed with invalid input
160 166
             }
@@ -185,7 +191,8 @@  discard block
 block discarded – undo
185 191
         // add ends appropriately
186 192
         if ($startAnchor && !$endAnchor) {
187 193
             $pattern .= '%';
188
-        } elseif (!$startAnchor && $endAnchor) {
194
+        }
195
+        elseif (!$startAnchor && $endAnchor) {
189 196
             $pattern = '%'.$pattern;
190 197
         }
191 198
 
@@ -220,7 +227,8 @@  discard block
 block discarded – undo
220 227
         if (str_contains($pattern, 'macros.')) {
221 228
             if (++$x < 30) {
222 229
                 $pattern = self::applyGroupMacros($pattern, $x);
223
-            } else {
230
+            }
231
+            else {
224 232
                 return false;
225 233
             }
226 234
         }
Please login to merge, or discard this patch.