@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | /** @var Invoice $invoice */ |
67 | 67 | $loan = $invoice->getLoan(); |
68 | 68 | |
69 | - if (! $this->checkerService->isCalculationAllowed($invoice, $overdueDays)) { |
|
69 | + if (!$this->checkerService->isCalculationAllowed($invoice, $overdueDays)) { |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | $disableLoanZeroInterestSetting = $this |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | $disableLoanZeroInterest = ($disableLoanZeroInterestSetting > 0 && $overdueDays >= $disableLoanZeroInterestSetting + 1); |
77 | 77 | |
78 | - if (! $disableLoanZeroInterest) { |
|
78 | + if (!$disableLoanZeroInterest) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 |
@@ -21,7 +21,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -25,12 +25,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -14,7 +14,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $criteria = new $criteria(); |
65 | 65 | } |
66 | 66 | |
67 | - if (! $criteria instanceof CriteriaInterface) { |
|
67 | + if (!$criteria instanceof CriteriaInterface) { |
|
68 | 68 | throw new RepositoryException( |
69 | 69 | 'Class ' . \get_class($criteria) . ' must be an instance of ' . CriteriaInterface::class |
70 | 70 | ); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function popCriteria($criteria): self |
86 | 86 | { |
87 | - $this->criteria = $this->criteria->reject(function ($value) use ($criteria) { |
|
87 | + $this->criteria = $this->criteria->reject(function($value) use ($criteria) { |
|
88 | 88 | if (\is_object($value) && \is_string($criteria)) { |
89 | 89 | return \get_class($value) === $criteria; |
90 | 90 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $criteria = $this->getCriteria(); |
114 | 114 | |
115 | - if (! $criteria) { |
|
115 | + if (!$criteria) { |
|
116 | 116 | return $this; |
117 | 117 | } |
118 | 118 |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function parseExpression($filterValue): string |
158 | 158 | { |
159 | - if (! \is_array($filterValue)) { |
|
159 | + if (!\is_array($filterValue)) { |
|
160 | 160 | return config('repositories.filtering.default_expression', '$eq'); |
161 | 161 | } |
162 | 162 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $parsedDataType = substr($value, 0, $lastColonPosition); |
181 | 181 | |
182 | - if (! $this->isValidDataType($parsedDataType)) { |
|
182 | + if (!$this->isValidDataType($parsedDataType)) { |
|
183 | 183 | return config('repositories.filtering.default_data_type', '$string'); |
184 | 184 | } |
185 | 185 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | { |
199 | 199 | $value = $this->extractValue($filterValue); |
200 | 200 | |
201 | - if (Str::startsWith($value, ['$']) && false !== strpos($value, ':')) { |
|
201 | + if (Str::startsWith($value, [ '$' ]) && false !== strpos($value, ':')) { |
|
202 | 202 | $lastColonPosition = strpos($value, ':'); |
203 | 203 | |
204 | 204 | return substr($value, $lastColonPosition + 1); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | private function extractValue($filterValue): string |
216 | 216 | { |
217 | - if (! \is_array($filterValue)) { |
|
217 | + if (!\is_array($filterValue)) { |
|
218 | 218 | return $filterValue; |
219 | 219 | } |
220 | 220 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | private function isValidDataType($dataType, $strict = false): bool |
233 | 233 | { |
234 | - if (! \in_array($dataType, config('repositories.filtering.allowed_data_types', '$string'), true)) { |
|
234 | + if (!\in_array($dataType, config('repositories.filtering.allowed_data_types', '$string'), true)) { |
|
235 | 235 | if ($strict) { |
236 | 236 | throw new RepositoryException('Invalid/Unallowed data type passed.'); |
237 | 237 | } |