Passed
Pull Request — master (#14)
by ARCANEDEV
08:06
created
src/Authorization/Http/Datatables/UsersDatatable.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,8 +144,7 @@
 block discarded – undo
144 144
             })->can(function () use ($user) {
145 145
                 return UsersPolicy::can('deactivate', [$user]);
146 146
             })->asIcon();
147
-        }
148
-        else {
147
+        } else {
149 148
             $actions[] = Action::button('activate', 'Activate', function () use ($user) {
150 149
                 return "ARCANESOFT.emit('authorization::users.activate', {id: '{$user->getRouteKey()}'})";
151 150
             })->can(function () use ($user) {
Please login to merge, or discard this patch.
src/Authorization/Http/Datatables/AdministratorDatatable.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,8 +143,7 @@
 block discarded – undo
143 143
             })->can(function () use ($administrator) {
144 144
                 return AdministratorsPolicy::can('deactivate', [$administrator]);
145 145
             })->asIcon();
146
-        }
147
-        else {
146
+        } else {
148 147
             $actions[] = Action::button('activate', 'Activate', function () use ($administrator) {
149 148
                 return "ARCANESOFT.emit('authorization::administrators.activate', {id: '{$administrator->getRouteKey()}'})";
150 149
             })->can(function () use ($administrator) {
Please login to merge, or discard this patch.
src/Authorization/Http/Datatables/PasswordResetsDatatable.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,8 +109,7 @@
 block discarded – undo
109 109
             })->can(function () use ($role) {
110 110
                 return PasswordResetsPolicy::can('deactivate', [$role]);
111 111
             })->asIcon();
112
-        }
113
-        else {
112
+        } else {
114 113
             $actions[] = Action::button('activate', 'Activate', function () use ($role) {
115 114
                 return "ARCANESOFT.emit('authorization::roles.activate', {id: '{$role->getRouteKey()}'})";
116 115
             })->can(function () use ($role) {
Please login to merge, or discard this patch.
src/Authorization/Http/Datatables/RolesDatatable.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -141,8 +141,7 @@
 block discarded – undo
141 141
             })->can(function () use ($role) {
142 142
                 return RolesPolicy::can('deactivate', [$role]);
143 143
             })->asIcon();
144
-        }
145
-        else {
144
+        } else {
146 145
             $actions[] = Action::button('activate', 'Activate', function () use ($role) {
147 146
                 return "ARCANESOFT.emit('authorization::roles.activate', {id: '{$role->getRouteKey()}'})";
148 147
             })->can(function () use ($role) {
Please login to merge, or discard this patch.
src/Datatable/Concerns/HasColumns.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,8 +112,9 @@  discard block
 block discarded – undo
112 112
             return $column->toArray();
113 113
         }, $this->columns());
114 114
 
115
-        if ($this->hasTrait(HasActions::class))
116
-            $columns[] = $this->getActionsColumnMeta();
115
+        if ($this->hasTrait(HasActions::class)) {
116
+                    $columns[] = $this->getActionsColumnMeta();
117
+        }
117 118
 
118 119
         return $columns;
119 120
     }
@@ -153,8 +154,9 @@  discard block
 block discarded – undo
153 154
 
154 155
         $results = array_map(function (array $sortedColumn) use ($columns): ?Column {
155 156
             foreach ($columns as $column) {
156
-                if ($sortedColumn['key'] === $column->key())
157
-                    return $column->sortDirection($sortedColumn['direction']);
157
+                if ($sortedColumn['key'] === $column->key()) {
158
+                                    return $column->sortDirection($sortedColumn['direction']);
159
+                }
158 160
             }
159 161
 
160 162
             return null;
Please login to merge, or discard this patch.
src/Datatable/Concerns/HasFilters.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@
 block discarded – undo
54 54
     {
55 55
         $filtered = $this->filtersQuery($request);
56 56
 
57
-        if (empty($filtered))
58
-            return $resources;
57
+        if (empty($filtered)) {
58
+                    return $resources;
59
+        }
59 60
 
60 61
         foreach ($this->filters($request) as $filter) {
61 62
             if (isset($filtered[$filter->getName()])) {
Please login to merge, or discard this patch.
src/Datatable/Column.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -243,14 +243,17 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function sortable(?string $direction = null, Closure $callback = null): self
245 245
     {
246
-        if ( ! $this->isSortable())
247
-            $this->sortable = true;
246
+        if ( ! $this->isSortable()) {
247
+                    $this->sortable = true;
248
+        }
248 249
 
249
-        if ($direction)
250
-            $this->sortDirection($direction);
250
+        if ($direction) {
251
+                    $this->sortDirection($direction);
252
+        }
251 253
 
252
-        if ($callback)
253
-            $this->sortQuery($callback);
254
+        if ($callback) {
255
+                    $this->sortQuery($callback);
256
+        }
254 257
 
255 258
         return $this;
256 259
     }
@@ -323,8 +326,9 @@  discard block
 block discarded – undo
323 326
      */
324 327
     public function hasSortByDirection(): bool
325 328
     {
326
-        if (is_null($this->direction))
327
-            return false;
329
+        if (is_null($this->direction)) {
330
+                    return false;
331
+        }
328 332
 
329 333
         return in_array(strtolower($this->direction), [static::SORT_ASC, static::SORT_DESC]);
330 334
     }
Please login to merge, or discard this patch.
src/Datatable/Filter.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -154,8 +154,9 @@
 block discarded – undo
154 154
      */
155 155
     public function apply($resources, $value)
156 156
     {
157
-        if ($this->getValue() === $value)
158
-            return $resources;
157
+        if ($this->getValue() === $value) {
158
+                    return $resources;
159
+        }
159 160
 
160 161
         return ($this->query)($resources, $value);
161 162
     }
Please login to merge, or discard this patch.
src/Datatable/Datatable.php 1 patch
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -125,11 +125,13 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $query = app()->call([$this, 'handle'], compact('request'));
127 127
 
128
-        if ($query instanceof Builder)
129
-            return $this->handleQuery($query, $request);
128
+        if ($query instanceof Builder) {
129
+                    return $this->handleQuery($query, $request);
130
+        }
130 131
 
131
-        if ($query instanceof Collection)
132
-            return $this->handleCollection($query, $request);
132
+        if ($query instanceof Collection) {
133
+                    return $this->handleCollection($query, $request);
134
+        }
133 135
     }
134 136
 
135 137
     /**
@@ -144,11 +146,13 @@  discard block
 block discarded – undo
144 146
     {
145 147
         $this->applySortByQuery($request, $query);
146 148
 
147
-        if ($this->hasTrait(HasFilters::class))
148
-            $query = $this->callMethod('applyFilters', compact('request', 'query'));
149
+        if ($this->hasTrait(HasFilters::class)) {
150
+                    $query = $this->callMethod('applyFilters', compact('request', 'query'));
151
+        }
149 152
 
150
-        if ($this->hasTrait(HasPagination::class))
151
-            return $query->paginate(call_user_func_array([$this, 'getPerPage'], [$request]));
153
+        if ($this->hasTrait(HasPagination::class)) {
154
+                    return $query->paginate(call_user_func_array([$this, 'getPerPage'], [$request]));
155
+        }
152 156
 
153 157
         return $query->get();
154 158
     }
@@ -163,8 +167,9 @@  discard block
 block discarded – undo
163 167
      */
164 168
     protected function handleCollection(Collection $collection, Request $request)
165 169
     {
166
-        if ($this->hasTrait(HasFilters::class))
167
-            $collection = $this->callMethod('applyFilters', compact('request', 'collection'));
170
+        if ($this->hasTrait(HasFilters::class)) {
171
+                    $collection = $this->callMethod('applyFilters', compact('request', 'collection'));
172
+        }
168 173
 
169 174
         $collection = $this->applySortByCollection($request, $collection);
170 175
 
@@ -186,8 +191,9 @@  discard block
 block discarded – undo
186 191
      */
187 192
     protected function transformResults(Request $request, $items): array
188 193
     {
189
-        if ($items instanceof LengthAwarePaginator)
190
-            $items = $items->getCollection();
194
+        if ($items instanceof LengthAwarePaginator) {
195
+                    $items = $items->getCollection();
196
+        }
191 197
 
192 198
         $transformer = $this->transformer();
193 199
 
Please login to merge, or discard this patch.