Test Setup Failed
Push — master ( d71b5a...3d6544 )
by noitran
05:59
created
src/ServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         } else {
29 29
             $publishPath = base_path('config/repositories.php');
30 30
         }
31
-        $this->publishes([$configPath => $publishPath], 'config');
31
+        $this->publishes([ $configPath => $publishPath ], 'config');
32 32
     }
33 33
 
34 34
     /**
Please login to merge, or discard this patch.
src/Criteria/OrderBy.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function setOrderByParameters($orderBy): void
45 45
     {
46
-        [$column, $direction] = explode(',', $orderBy);
46
+        [ $column, $direction ] = explode(',', $orderBy);
47 47
 
48 48
         $this->column = $column;
49 49
         $this->direction = $direction ?? 'asc';
50 50
 
51
-        if (! \in_array($this->direction, ['asc', 'desc'])) {
51
+        if (!\in_array($this->direction, [ 'asc', 'desc' ])) {
52 52
             $this->direction = 'asc';
53 53
         }
54 54
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             return $model;
68 68
         }
69 69
 
70
-        if (! preg_match($this->allowedToContain, $this->column)) {
70
+        if (!preg_match($this->allowedToContain, $this->column)) {
71 71
             throw new ValidationException('OrderBy query parameter contains illegal characters.');
72 72
         }
73 73
 
Please login to merge, or discard this patch.
src/Repositories/Concerns/InteractsWithSchema.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     public function getColumnNames(array $columns, $model = null): array
31 31
     {
32
-        return array_map(function ($column) use ($model) {
32
+        return array_map(function($column) use ($model) {
33 33
             return $this->getColumnName($column, $model);
34 34
         }, $columns);
35 35
     }
Please login to merge, or discard this patch.
src/Repositories/AbstractRepository.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $model = $this->app->make($this->getModelClassName());
90 90
 
91
-        if (! $model instanceof Model) {
91
+        if (!$model instanceof Model) {
92 92
             throw new RepositoryException(
93 93
                 "Class {$this->getModelClassName()} must be an instance of " . Model::class
94 94
             );
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      *
158 158
      * @return EloquentBuilder[]|\Illuminate\Database\Eloquent\Collection|Model[]|mixed
159 159
      */
160
-    public function all($columns = ['*'])
160
+    public function all($columns = [ '*' ])
161 161
     {
162 162
         $this->applyCriteria()
163 163
             ->applyScope();
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @return EloquentBuilder[]|\Illuminate\Database\Eloquent\Collection|Model[]|mixed
185 185
      */
186
-    public function get($columns = ['*'])
186
+    public function get($columns = [ '*' ])
187 187
     {
188 188
         return $this->all($columns);
189 189
     }
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
      *
199 199
      * @return mixed
200 200
      */
201
-    public function paginate(int $perPage = null, $columns = ['*'])
201
+    public function paginate(int $perPage = null, $columns = [ '*' ])
202 202
     {
203
-        return $this->getPaginator($perPage, $columns, function ($perPage, $columns) {
203
+        return $this->getPaginator($perPage, $columns, function($perPage, $columns) {
204 204
             return $this->model
205 205
                 ->paginate($perPage, $columns)
206 206
                 ->appends(app('request')->query());
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
      *
216 216
      * @return mixed
217 217
      */
218
-    public function simplePaginate(int $perPage = null, $columns = ['*'])
218
+    public function simplePaginate(int $perPage = null, $columns = [ '*' ])
219 219
     {
220
-        return $this->getPaginator($perPage, $columns, function ($perPage, $columns) {
220
+        return $this->getPaginator($perPage, $columns, function($perPage, $columns) {
221 221
             return $this->model
222 222
                 ->simplePaginate($perPage, $columns)
223 223
                 ->appends(app('request')->query());
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
      *
234 234
      * @return mixed
235 235
      */
236
-    protected function getPaginator(int $perPage = null, $columns = ['*'], callable $callback = null)
236
+    protected function getPaginator(int $perPage = null, $columns = [ '*' ], callable $callback = null)
237 237
     {
238 238
         $this->applyCriteria()
239 239
             ->applyScope();
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @return mixed
258 258
      */
259
-    public function find($id, $columns = ['*'])
259
+    public function find($id, $columns = [ '*' ])
260 260
     {
261 261
         $this->applyCriteria()
262 262
             ->applyScope();
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @return mixed
279 279
      */
280
-    public function findByField($field, $value = null, $columns = ['*'])
280
+    public function findByField($field, $value = null, $columns = [ '*' ])
281 281
     {
282 282
         $this->applyCriteria()
283 283
             ->applyScope();
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      *
301 301
      * @return int
302 302
      */
303
-    public function count($columns = ['*']): int
303
+    public function count($columns = [ '*' ]): int
304 304
     {
305 305
         $this->applyCriteria()
306 306
             ->applyScope();
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      *
322 322
      * @return mixed
323 323
      */
324
-    public function first($columns = ['*']): ?Model
324
+    public function first($columns = [ '*' ]): ?Model
325 325
     {
326 326
         $this->applyCriteria()
327 327
             ->applyScope();
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      *
341 341
      * @return Model|null
342 342
      */
343
-    public function create(array $attributes = []): ?Model
343
+    public function create(array $attributes = [ ]): ?Model
344 344
     {
345 345
         $model = $this->model->create($attributes);
346 346
         $this->clearModel();
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     {
362 362
         $this->applyScope();
363 363
 
364
-        if (! $model instanceof Model) {
364
+        if (!$model instanceof Model) {
365 365
             $model = $this->model->findOrFail($model);
366 366
         }
367 367
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
     {
384 384
         $this->applyScope();
385 385
 
386
-        if (! $model instanceof Model) {
386
+        if (!$model instanceof Model) {
387 387
             $model = $this->find($model);
388 388
         }
389 389
 
Please login to merge, or discard this patch.
src/Filters/Preloadable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function getWith(): array
17 17
     {
18
-        return $this->getPreloadables()['with'] ?? [];
18
+        return $this->getPreloadables()[ 'with' ] ?? [ ];
19 19
     }
20 20
 
21 21
     /**
@@ -23,6 +23,6 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function getWithCount(): array
25 25
     {
26
-        return $this->getPreloadables()['withCount'] ?? [];
26
+        return $this->getPreloadables()[ 'withCount' ] ?? [ ];
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Requests/InteractsWithRequest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
      *
18 18
      * @return array
19 19
      */
20
-    public function only($keys, array $input = []): array
20
+    public function only($keys, array $input = [ ]): array
21 21
     {
22 22
         $keys = \is_array($keys) ? $keys : \func_get_args();
23 23
 
24
-        $output = [];
24
+        $output = [ ];
25 25
 
26 26
         foreach ($keys as $key) {
27 27
             Arr::set($output, $key, data_get($input, $key));
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @return array
40 40
      */
41
-    public function except($keys, array $input = []): array
41
+    public function except($keys, array $input = [ ]): array
42 42
     {
43 43
         $keys = \is_array($keys) ? $keys : \func_get_args();
44 44
 
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return bool
57 57
      */
58
-    public function exists($key, array $input = []): bool
58
+    public function exists($key, array $input = [ ]): bool
59 59
     {
60 60
         $keys = \is_array($key) ? $key : \func_get_args();
61 61
 
62 62
         foreach ($keys as $value) {
63
-            if (! Arr::has($input, $value)) {
63
+            if (!Arr::has($input, $value)) {
64 64
                 return false;
65 65
             }
66 66
         }
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getQueryParams(array $queryFilters): array
79 79
     {
80
-        return array_map(function ($param) {
81
-            return $param['queryParameter'];
80
+        return array_map(function($param) {
81
+            return $param[ 'queryParameter' ];
82 82
         }, $queryFilters);
83 83
     }
84 84
 }
Please login to merge, or discard this patch.
src/Contracts/Repository/RepositoryInterface.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return mixed
23 23
      */
24
-    public function all($columns = ['*']);
24
+    public function all($columns = [ '*' ]);
25 25
 
26 26
     /**
27 27
      * Get collection of paginated records.
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      *
34 34
      * @return mixed
35 35
      */
36
-    public function paginate(int $perPage = null, $columns = ['*']);
36
+    public function paginate(int $perPage = null, $columns = [ '*' ]);
37 37
 
38 38
     /**
39 39
      * @param int|null $perPage
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return mixed
45 45
      */
46
-    public function simplePaginate(int $perPage = null, $columns = ['*']);
46
+    public function simplePaginate(int $perPage = null, $columns = [ '*' ]);
47 47
 
48 48
     /**
49 49
      * Get single or multiple records by their primary ids.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return mixed
57 57
      */
58
-    public function find($id, $columns = ['*']);
58
+    public function find($id, $columns = [ '*' ]);
59 59
 
60 60
     /**
61 61
      * @param $field
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return mixed
68 68
      */
69
-    public function findByField($field, $value = null, $columns = ['*']);
69
+    public function findByField($field, $value = null, $columns = [ '*' ]);
70 70
 
71 71
     /**
72 72
      * Count results of repository.
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      *
78 78
      * @return int
79 79
      */
80
-    public function count($columns = ['*']): int;
80
+    public function count($columns = [ '*' ]): int;
81 81
 
82 82
     /**
83 83
      * Execute the query and get the first result.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      *
89 89
      * @return mixed
90 90
      */
91
-    public function first($columns = ['*']): ?Model;
91
+    public function first($columns = [ '*' ]): ?Model;
92 92
 
93 93
     /**
94 94
      * @param array $attributes
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      *
98 98
      * @return Model|null
99 99
      */
100
-    public function create(array $attributes = []): ?Model;
100
+    public function create(array $attributes = [ ]): ?Model;
101 101
 
102 102
     /**
103 103
      * @param mixed $model
Please login to merge, or discard this patch.
src/Filters/AbstractFilter.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * @var array
27 27
      */
28
-    protected $queryFilters = [];
28
+    protected $queryFilters = [ ];
29 29
 
30 30
     /**
31 31
      * @var array
32 32
      */
33
-    protected $querySettings = [];
33
+    protected $querySettings = [ ];
34 34
 
35 35
     /**
36 36
      * @var FilterStra
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return AbstractFilter
65 65
      */
66
-    public function setQueryFilters(array $queryFilters = []): self
66
+    public function setQueryFilters(array $queryFilters = [ ]): self
67 67
     {
68
-        $defaultQueryFilters = config('repositories.filtering.default_filters', []);
68
+        $defaultQueryFilters = config('repositories.filtering.default_filters', [ ]);
69 69
 
70 70
         $this->queryFilters = array_merge($defaultQueryFilters, $queryFilters);
71 71
 
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return AbstractFilter
87 87
      */
88
-    public function setQuerySettings(array $querySettings = []): self
88
+    public function setQuerySettings(array $querySettings = [ ]): self
89 89
     {
90
-        $defaultQuerySettings = config('repositories.filtering.default_settings', []);
90
+        $defaultQuerySettings = config('repositories.filtering.default_settings', [ ]);
91 91
         $this->querySettings = array_merge($defaultQuerySettings, $querySettings);
92 92
 
93 93
         return $this;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      *
108 108
      * @return array
109 109
      */
110
-    protected function getInput(array $queryFilters = [], array $request = []): array
110
+    protected function getInput(array $queryFilters = [ ], array $request = [ ]): array
111 111
     {
112 112
         $queryKeys = array_keys($this->getQuerySettings());
113 113
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 
119 119
         return array_merge(
120 120
             $this->getQuerySettings(),
121
-            array_filter($input, function ($value) {
121
+            array_filter($input, function($value) {
122 122
                 return null !== $value;
123 123
             })
124 124
         );
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @return RepositoryInterface
132 132
      */
133
-    protected function pushFilters(RepositoryInterface $repository, array $input = []): RepositoryInterface
133
+    protected function pushFilters(RepositoryInterface $repository, array $input = [ ]): RepositoryInterface
134 134
     {
135 135
         foreach ($this->getQueryFilters() as $filter) {
136
-            if (isset($input[$filter['queryParameter']])) {
136
+            if (isset($input[ $filter[ 'queryParameter' ] ])) {
137 137
                 $repository = $repository->pushCriteria(
138
-                    new $filter['uses'](
139
-                        $input[$filter['queryParameter']]
138
+                    new $filter[ 'uses' ](
139
+                        $input[ $filter[ 'queryParameter' ] ]
140 140
                     )
141 141
                 );
142 142
             }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function paginate(int $perPage = null)
221 221
     {
222
-        if (! $perPage) {
222
+        if (!$perPage) {
223 223
             $perPage = config('repositories.filtering.default_settings.per_page');
224 224
         }
225 225
 
Please login to merge, or discard this patch.
src/Repositories/SqlRepository.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     /**
15 15
      * {@inheritdoc}
16 16
      */
17
-    public function all($columns = ['*'])
17
+    public function all($columns = [ '*' ])
18 18
     {
19 19
         return parent::all(
20 20
             $this->getColumnNames($columns)
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * {@inheritdoc}
26 26
      */
27
-    public function paginate(int $perPage = null, $columns = ['*'])
27
+    public function paginate(int $perPage = null, $columns = [ '*' ])
28 28
     {
29 29
         return parent::paginate(
30 30
             $perPage,
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * {@inheritdoc}
37 37
      */
38
-    public function simplePaginate(int $perPage = null, $columns = ['*'])
38
+    public function simplePaginate(int $perPage = null, $columns = [ '*' ])
39 39
     {
40 40
         return parent::simplePaginate(
41 41
             $perPage,
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     /**
47 47
      * {@inheritdoc}
48 48
      */
49
-    public function find($id, $columns = ['*'])
49
+    public function find($id, $columns = [ '*' ])
50 50
     {
51 51
         return parent::find(
52 52
             $id,
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     /**
58 58
      * {@inheritdoc}
59 59
      */
60
-    public function findByField($field, $value = null, $columns = ['*'])
60
+    public function findByField($field, $value = null, $columns = [ '*' ])
61 61
     {
62 62
         return parent::findByField(
63 63
             $this->getColumnName($field),
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     /**
70 70
      * {@inheritdoc}
71 71
      */
72
-    public function first($columns = ['*']): ?Model
72
+    public function first($columns = [ '*' ]): ?Model
73 73
     {
74 74
         return parent::first(
75 75
             $this->getColumnNames($columns)
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     {
87 87
         $model = $model ?? $this->model;
88 88
 
89
-        return ! strpos($column, '.')
89
+        return !strpos($column, '.')
90 90
             ? $this->getSchemaName($model) . '.' . $column
91 91
             : $column;
92 92
     }
Please login to merge, or discard this patch.