@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $count = 0; |
109 | 109 | |
110 | 110 | foreach ($this->execute() as $result) { |
111 | - $count += (int)$result['aggregate']; |
|
111 | + $count += (int) $result['aggregate']; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | $this->compilerState->invalidate(['columns', 'orders']); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | #[ReadOperation] |
124 | 124 | public function count($column = null) |
125 | 125 | { |
126 | - return (int)array_sum($this->aggregate(__FUNCTION__, $column)); |
|
126 | + return (int) array_sum($this->aggregate(__FUNCTION__, $column)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | $numbers = $this->aggregate(__FUNCTION__, $column); |
136 | 136 | |
137 | - return array_sum($numbers)/count($numbers); |
|
137 | + return array_sum($numbers) / count($numbers); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | #[ReadOperation] |
144 | 144 | public function min($column = null) |
145 | 145 | { |
146 | - return (float)min($this->aggregate(__FUNCTION__, $column)); |
|
146 | + return (float) min($this->aggregate(__FUNCTION__, $column)); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | #[ReadOperation] |
153 | 153 | public function max($column = null) |
154 | 154 | { |
155 | - return (float)max($this->aggregate(__FUNCTION__, $column)); |
|
155 | + return (float) max($this->aggregate(__FUNCTION__, $column)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | #[ReadOperation] |
162 | 162 | public function sum($column = null) |
163 | 163 | { |
164 | - return (float)array_sum($this->aggregate(__FUNCTION__, $column)); |
|
164 | + return (float) array_sum($this->aggregate(__FUNCTION__, $column)); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | #[WriteOperation] |
154 | 154 | public function saveAll($relations = []) |
155 | 155 | { |
156 | - return $this->relation->saveAll($this->owner, (array)$relations); |
|
156 | + return $this->relation->saveAll($this->owner, (array) $relations); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | #[WriteOperation] |
168 | 168 | public function deleteAll($relations = []) |
169 | 169 | { |
170 | - return $this->relation->deleteAll($this->owner, (array)$relations); |
|
170 | + return $this->relation->deleteAll($this->owner, (array) $relations); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function ignore($flag = true) |
144 | 144 | { |
145 | - $this->statements['ignore'] = (bool)$flag; |
|
145 | + $this->statements['ignore'] = (bool) $flag; |
|
146 | 146 | |
147 | 147 | return $this; |
148 | 148 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $this->statements['offset'] = null; |
267 | 267 | $this->statements['aggregate'] = ['pagination', $this->getPaginationColumns($columns)]; |
268 | 268 | |
269 | - $count = (int)$this->execute()[0]['aggregate']; |
|
269 | + $count = (int) $this->execute()[0]['aggregate']; |
|
270 | 270 | |
271 | 271 | $this->compilerState->invalidate(['columns', 'orders']); |
272 | 272 | $this->statements = $statements; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | #[ReadOperation] |
312 | 312 | public function count($column = null) |
313 | 313 | { |
314 | - return (int)$this->aggregate(__FUNCTION__, $column); |
|
314 | + return (int) $this->aggregate(__FUNCTION__, $column); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | #[ReadOperation] |
321 | 321 | public function avg($column = null) |
322 | 322 | { |
323 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
323 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | #[ReadOperation] |
330 | 330 | public function min($column = null) |
331 | 331 | { |
332 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
332 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | #[ReadOperation] |
339 | 339 | public function max($column = null) |
340 | 340 | { |
341 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
341 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | #[ReadOperation] |
348 | 348 | public function sum($column = null) |
349 | 349 | { |
350 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
350 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | $this->compilerState->invalidate('columns'); |
379 | 379 | |
380 | - $this->statements['distinct'] = (bool)$flag; |
|
380 | + $this->statements['distinct'] = (bool) $flag; |
|
381 | 381 | |
382 | 382 | return $this; |
383 | 383 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | # build a regular expression for each parameter |
563 | 563 | foreach ($values as $key => $value) { |
564 | 564 | if (is_string($key)) { |
565 | - $keys[] = '/:' . $key . '/'; |
|
565 | + $keys[] = '/:'.$key.'/'; |
|
566 | 566 | } else { |
567 | 567 | $keys[] = '/[?]/'; |
568 | 568 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct(string $entityClass, string $message = '', ?Throwable $previous = null) |
26 | 26 | { |
27 | - parent::__construct($entityClass . ' : ' . $message, 0, $previous); |
|
27 | + parent::__construct($entityClass.' : '.$message, 0, $previous); |
|
28 | 28 | |
29 | 29 | $this->entityClass = $entityClass; |
30 | 30 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | #[ReadOperation] |
69 | 69 | public function load($relations) |
70 | 70 | { |
71 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
71 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
72 | 72 | $this->repository->relation($relationName)->load( |
73 | 73 | EntityIndexer::fromArray($this->repository->mapper(), $this->storage->all()), |
74 | 74 | $meta['relations'], |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | #[WriteOperation] |
134 | 134 | public function delete() |
135 | 135 | { |
136 | - $this->repository->transaction(function (RepositoryInterface $repository) { |
|
136 | + $this->repository->transaction(function(RepositoryInterface $repository) { |
|
137 | 137 | $writer = new BufferedWriter($repository); |
138 | 138 | |
139 | 139 | foreach ($this as $entity) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | #[WriteOperation] |
156 | 156 | public function save() |
157 | 157 | { |
158 | - $this->repository->transaction(function (RepositoryInterface $repository) { |
|
158 | + $this->repository->transaction(function(RepositoryInterface $repository) { |
|
159 | 159 | foreach ($this as $entity) { |
160 | 160 | $repository->save($entity); |
161 | 161 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | #[WriteOperation] |
177 | 177 | public function saveAll($relations) |
178 | 178 | { |
179 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
179 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
180 | 180 | |
181 | 181 | return $this->repository->transaction(function(RepositoryInterface $repository) use($relations) { |
182 | 182 | $nb = 0; |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | #[WriteOperation] |
206 | 206 | public function deleteAll($relations) |
207 | 207 | { |
208 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
208 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
209 | 209 | |
210 | 210 | return $this->repository->transaction(function(RepositoryInterface $repository) use($relations) { |
211 | 211 | $nb = 0; |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | #[ReadOperation] |
308 | 308 | public function loadRelations($entity, $relations) |
309 | 309 | { |
310 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
310 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
311 | 311 | $this->relation($relationName)->loadIfNotLoaded( |
312 | 312 | new SingleEntityIndexer($this->mapper, $entity), |
313 | 313 | $meta['relations'], |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | #[ReadOperation] |
331 | 331 | public function reloadRelations($entity, $relations) |
332 | 332 | { |
333 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
333 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
334 | 334 | $this->relation($relationName)->load( |
335 | 335 | new SingleEntityIndexer($this->mapper, $entity), |
336 | 336 | $meta['relations'], |
@@ -376,12 +376,12 @@ discard block |
||
376 | 376 | #[WriteOperation] |
377 | 377 | public function saveAll($entity, $relations) |
378 | 378 | { |
379 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
379 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
380 | 380 | |
381 | 381 | return $this->transaction(function() use($entity, $relations) { |
382 | 382 | $nb = $this->save($entity); |
383 | 383 | |
384 | - foreach ((array)$relations as $relationName => $info) { |
|
384 | + foreach ((array) $relations as $relationName => $info) { |
|
385 | 385 | $nb += $this->relation($relationName)->saveAll($entity, $info['relations']); |
386 | 386 | } |
387 | 387 | |
@@ -401,12 +401,12 @@ discard block |
||
401 | 401 | #[WriteOperation] |
402 | 402 | public function deleteAll($entity, $relations) |
403 | 403 | { |
404 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
404 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
405 | 405 | |
406 | 406 | return $this->transaction(function() use($entity, $relations) { |
407 | 407 | $nb = $this->delete($entity); |
408 | 408 | |
409 | - foreach ((array)$relations as $relationName => $info) { |
|
409 | + foreach ((array) $relations as $relationName => $info) { |
|
410 | 410 | $nb += $this->relation($relationName)->deleteAll($entity, $info['relations']); |
411 | 411 | } |
412 | 412 |