@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function loadRelations($entity, $relations) |
301 | 301 | { |
302 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
302 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
303 | 303 | $this->relation($relationName)->loadIfNotLoaded( |
304 | 304 | new SingleEntityIndexer($this->mapper, $entity), |
305 | 305 | $meta['relations'], |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function reloadRelations($entity, $relations) |
322 | 322 | { |
323 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
323 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
324 | 324 | $this->relation($relationName)->load( |
325 | 325 | new SingleEntityIndexer($this->mapper, $entity), |
326 | 326 | $meta['relations'], |
@@ -364,12 +364,12 @@ discard block |
||
364 | 364 | */ |
365 | 365 | public function saveAll($entity, $relations) |
366 | 366 | { |
367 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
367 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
368 | 368 | |
369 | 369 | return $this->transaction(function() use($entity, $relations) { |
370 | 370 | $nb = $this->save($entity); |
371 | 371 | |
372 | - foreach ((array)$relations as $relationName => $info) { |
|
372 | + foreach ((array) $relations as $relationName => $info) { |
|
373 | 373 | $nb += $this->relation($relationName)->saveAll($entity, $info['relations']); |
374 | 374 | } |
375 | 375 | |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function deleteAll($entity, $relations) |
389 | 389 | { |
390 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
390 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
391 | 391 | |
392 | 392 | return $this->transaction(function() use($entity, $relations) { |
393 | 393 | $nb = $this->delete($entity); |
394 | 394 | |
395 | - foreach ((array)$relations as $relationName => $info) { |
|
395 | + foreach ((array) $relations as $relationName => $info) { |
|
396 | 396 | $nb += $this->relation($relationName)->deleteAll($entity, $info['relations']); |
397 | 397 | } |
398 | 398 |
@@ -186,7 +186,7 @@ |
||
186 | 186 | $this->statements['offset'] = null; |
187 | 187 | $this->statements['aggregate'] = ['count', $columns ?: '*']; |
188 | 188 | |
189 | - $count = (int)$this->execute()[0]['aggregate']; |
|
189 | + $count = (int) $this->execute()[0]['aggregate']; |
|
190 | 190 | |
191 | 191 | $this->compilerState->invalidate(); |
192 | 192 | $this->statements = $statements; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return $entity; |
127 | 127 | } |
128 | 128 | |
129 | - throw new EntityNotFoundException('Cannot resolve entity identifier "'.implode('", "', (array)$id).'"'); |
|
129 | + throw new EntityNotFoundException('Cannot resolve entity identifier "'.implode('", "', (array) $id).'"'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function with(ReadCommandInterface $query, $relations) |
174 | 174 | { |
175 | - $this->withRelations = Relation::sanitizeRelations((array)$relations); |
|
175 | + $this->withRelations = Relation::sanitizeRelations((array) $relations); |
|
176 | 176 | |
177 | 177 | return $query; |
178 | 178 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function without(ReadCommandInterface $query, $relations) |
189 | 189 | { |
190 | - $this->withoutRelations = Relation::sanitizeWithoutRelations((array)$relations); |
|
190 | + $this->withoutRelations = Relation::sanitizeWithoutRelations((array) $relations); |
|
191 | 191 | |
192 | 192 | return $query; |
193 | 193 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $scopes = $this->repository->scopes(); |
286 | 286 | |
287 | 287 | if (!isset($scopes[$name])) { |
288 | - throw new BadMethodCallException('Method "' . get_class($this->repository) . '::' . $name . '" not found'); |
|
288 | + throw new BadMethodCallException('Method "'.get_class($this->repository).'::'.$name.'" not found'); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $scopes[$name](...$arguments); |
@@ -126,7 +126,7 @@ |
||
126 | 126 | $this->buildRaw($statement, $value, $glue); |
127 | 127 | } else { |
128 | 128 | // Column with operator |
129 | - $key = explode(' ', trim($key), 2); |
|
129 | + $key = explode(' ', trim($key), 2); |
|
130 | 130 | $parts[] = [ |
131 | 131 | 'column' => $key[0], |
132 | 132 | 'operator' => isset($key[1]) ? $key[1] : '=', |
@@ -33,7 +33,7 @@ |
||
33 | 33 | */ |
34 | 34 | public function __toString() |
35 | 35 | { |
36 | - return (string)$this->value; |
|
36 | + return (string) $this->value; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | //TODO quand doit on unset l'index '0' ? |
59 | 59 | |
60 | - foreach ((array)$parts as $part) { |
|
60 | + foreach ((array) $parts as $part) { |
|
61 | 61 | unset($this->bindings[$part]); |
62 | 62 | unset($this->compiledParts[$part]); |
63 | 63 | } |
@@ -398,7 +398,7 @@ |
||
398 | 398 | } |
399 | 399 | |
400 | 400 | // If we have polymophism, add to alias |
401 | - $relation->join($this->query, $alias . (isset($relationName[1]) ? '#' . $relationName[1] : '')); |
|
401 | + $relation->join($this->query, $alias.(isset($relationName[1]) ? '#'.$relationName[1] : '')); |
|
402 | 402 | $relation->setLocalAlias(null); |
403 | 403 | } |
404 | 404 |
@@ -94,16 +94,16 @@ |
||
94 | 94 | */ |
95 | 95 | public function compiler($query) |
96 | 96 | { |
97 | - if (!isset($this->compilers[$query])) { |
|
98 | - return $this->defaultCompiler; |
|
99 | - } |
|
97 | + if (!isset($this->compilers[$query])) { |
|
98 | + return $this->defaultCompiler; |
|
99 | + } |
|
100 | 100 | |
101 | - $compiler = $this->compilers[$query]; |
|
101 | + $compiler = $this->compilers[$query]; |
|
102 | 102 | |
103 | - if (is_string($compiler)) { |
|
104 | - return $this->compilers[$query] = new $compiler($this->connection); |
|
105 | - } |
|
103 | + if (is_string($compiler)) { |
|
104 | + return $this->compilers[$query] = new $compiler($this->connection); |
|
105 | + } |
|
106 | 106 | |
107 | - return $compiler; |
|
107 | + return $compiler; |
|
108 | 108 | } |
109 | 109 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function ignore($flag = true) |
140 | 140 | { |
141 | - $this->statements['ignore'] = (bool)$flag; |
|
141 | + $this->statements['ignore'] = (bool) $flag; |
|
142 | 142 | |
143 | 143 | return $this; |
144 | 144 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $this->statements['offset'] = null; |
270 | 270 | $this->statements['aggregate'] = ['pagination', $this->getPaginationColumns($columns)]; |
271 | 271 | |
272 | - $count = (int)$this->execute()[0]['aggregate']; |
|
272 | + $count = (int) $this->execute()[0]['aggregate']; |
|
273 | 273 | |
274 | 274 | $this->compilerState->invalidate(['columns', 'orders']); |
275 | 275 | $this->statements = $statements; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function count($column = null) |
315 | 315 | { |
316 | - return (int)$this->aggregate(__FUNCTION__, $column); |
|
316 | + return (int) $this->aggregate(__FUNCTION__, $column); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function avg($column = null) |
323 | 323 | { |
324 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
324 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
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 | /** |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function max($column = null) |
339 | 339 | { |
340 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
340 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | public function sum($column = null) |
347 | 347 | { |
348 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
348 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | { |
375 | 375 | $this->compilerState->invalidate('columns'); |
376 | 376 | |
377 | - $this->statements['distinct'] = (bool)$flag; |
|
377 | + $this->statements['distinct'] = (bool) $flag; |
|
378 | 378 | |
379 | 379 | return $this; |
380 | 380 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | # build a regular expression for each parameter |
560 | 560 | foreach ($values as $key => $value) { |
561 | 561 | if (is_string($key)) { |
562 | - $keys[] = '/:' . $key . '/'; |
|
562 | + $keys[] = '/:'.$key.'/'; |
|
563 | 563 | } else { |
564 | 564 | $keys[] = '/[?]/'; |
565 | 565 | } |