Passed
Pull Request — master (#14)
by ARCANEDEV
05:42
created
src/Datatable/Concerns/HasColumns.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function getDefaultSortByForQuery(): Closure
60 60
     {
61
-        return function (Builder $query, Column $column) {
62
-            return $query->orderBy($column->key(),$column->getSortDirection() ?: Column::SORT_ASC);
61
+        return function(Builder $query, Column $column) {
62
+            return $query->orderBy($column->key(), $column->getSortDirection() ?: Column::SORT_ASC);
63 63
         };
64 64
     }
65 65
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     protected function getDefaultSortByForCollection(): Closure
94 94
     {
95
-        return function (Collection $collection, Column $column, Request $request) {
95
+        return function(Collection $collection, Column $column, Request $request) {
96 96
             return $collection->sortBy(
97 97
                 $column->key(),
98 98
                 SORT_REGULAR,
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     protected function getColumnsMeta(): array
110 110
     {
111
-        $columns = array_map(function (Column $column)  {
111
+        $columns = array_map(function(Column $column) {
112 112
             return $column->toArray();
113 113
         }, $this->columns());
114 114
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $columns = $this->getSortableColumns();
152 152
         $sortedColumns = (array) $request->input('query.sort_by', []);
153 153
 
154
-        $results = array_map(function (array $sortedColumn) use ($columns): ?Column {
154
+        $results = array_map(function(array $sortedColumn) use ($columns): ?Column {
155 155
             foreach ($columns as $column) {
156 156
                 if ($sortedColumn['key'] === $column->key())
157 157
                     return $column->sortDirection($sortedColumn['direction']);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      */
173 173
     protected function getSortByMeta(Request $request): array
174 174
     {
175
-        $columns = array_map(function (Column $column) {
175
+        $columns = array_map(function(Column $column) {
176 176
             return [
177 177
                 'key'       => $column->key(),
178 178
                 'direction' => $column->getSortDirection(),
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
      */
204 204
     protected function getSortableColumns(bool $withDirection = false): array
205 205
     {
206
-        $columns = array_filter($this->columns(), function (Column $column) use ($withDirection) {
206
+        $columns = array_filter($this->columns(), function(Column $column) use ($withDirection) {
207 207
             return $withDirection
208 208
                 ? ($column->isSortable() && $column->hasSortByDirection())
209 209
                 : $column->isSortable();
Please login to merge, or discard this 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 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
      */
38 38
     protected function getFiltersMeta(Request $request): array
39 39
     {
40
-        return array_map(function (Filter $filter) {
40
+        return array_map(function(Filter $filter) {
41 41
             return $filter->toArray();
42 42
         }, $this->filters($request));
43 43
     }
Please login to merge, or discard this 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/Concerns/HasActions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
      */
45 45
     protected function transformActions(Request $request, $resrouce): array
46 46
     {
47
-        return array_map(function (Action $action) {
47
+        return array_map(function(Action $action) {
48 48
             return $action->toArray();
49 49
         }, $this->actions($request, $resrouce));
50 50
     }
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/Filters/Select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
      */
58 58
     public function getOptions(): array
59 59
     {
60
-        return array_map(function (string $option) {
60
+        return array_map(function(string $option) {
61 61
             return __($option);
62 62
         }, $this->options);
63 63
     }
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/Action.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
      */
246 246
     public function toArray(): array
247 247
     {
248
-        return with(app(), function (Application $app) {
248
+        return with(app(), function(Application $app) {
249 249
             $allowed = $app->call($this->condition);
250 250
 
251 251
             return [
Please login to merge, or discard this patch.
src/Datatable/Datatable.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -191,7 +191,7 @@
 block discarded – undo
191 191
 
192 192
         $transformer = $this->transformer();
193 193
 
194
-        return $items->transform(function ($item) use ($request, $transformer) {
194
+        return $items->transform(function($item) use ($request, $transformer) {
195 195
             $actions = $this->callTraitMethod(HasActions::class, 'transformActions', [$request, $item]);
196 196
 
197 197
             return array_merge(
Please login to merge, or discard this 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', [$request, $query]);
149
+        if ($this->hasTrait(HasFilters::class)) {
150
+                    $query = $this->callMethod('applyFilters', [$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', [$request, $collection]);
170
+        if ($this->hasTrait(HasFilters::class)) {
171
+                    $collection = $this->callMethod('applyFilters', [$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.
src/System/Http/Routes/DependenciesRoutes.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@
 block discarded – undo
26 26
         $this->prefix('dependencies')->name('dependencies.')->group(function () {
27 27
             // admin::system.dependencies.index
28 28
             $this->get('/', [DependenciesController::class, 'index'])
29
-                 ->name('index');
29
+                    ->name('index');
30 30
 
31 31
             // admin::system.dependencies.datatable
32 32
             $this->post('datatable', [DependenciesController::class, 'datatable'])
33
-                 ->middleware(['ajax'])
34
-                 ->name('datatable');
33
+                    ->middleware(['ajax'])
34
+                    ->name('datatable');
35 35
 
36 36
             // admin::system.dependencies.show
37 37
             $this->get('{admin_package_vendor}/{admin_package_name}', [DependenciesController::class, 'show'])
38
-                 ->name('show');
38
+                    ->name('show');
39 39
         });
40 40
     }
41 41
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function map(): void
25 25
     {
26
-        $this->prefix('dependencies')->name('dependencies.')->group(function () {
26
+        $this->prefix('dependencies')->name('dependencies.')->group(function() {
27 27
             // admin::system.dependencies.index
28 28
             $this->get('/', [DependenciesController::class, 'index'])
29 29
                  ->name('index');
Please login to merge, or discard this patch.