@@ -110,7 +110,7 @@ |
||
| 110 | 110 | */ |
| 111 | 111 | protected function mode(): bool |
| 112 | 112 | { |
| 113 | - return \tap($this->conjunction, function () { |
|
| 113 | + return \tap($this->conjunction, function() { |
|
| 114 | 114 | $this->conjunction = true; |
| 115 | 115 | }); |
| 116 | 116 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | $name = $pattern |
| 52 | 52 | ? \snake_case(\class_basename($pattern)) |
| 53 | - : 'q' . Str::random(7); |
|
| 53 | + : 'q'.Str::random(7); |
|
| 54 | 54 | |
| 55 | 55 | return \sprintf('%s_%d', $name, ++static::$lastQueryId); |
| 56 | 56 | } |
@@ -61,6 +61,6 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function placeholder(string $pattern = null): string |
| 63 | 63 | { |
| 64 | - return ':' . $this->createAlias($pattern); |
|
| 64 | + return ':'.$this->createAlias($pattern); |
|
| 65 | 65 | } |
| 66 | 66 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function select(...$fields): self |
| 26 | 26 | { |
| 27 | 27 | foreach ($fields as $field) { |
| 28 | - if (! \is_array($field) && ! \is_string($field)) { |
|
| 28 | + if (!\is_array($field) && !\is_string($field)) { |
|
| 29 | 29 | $error = 'Selection should be array (["field" => "alias"]) or string ("field") but %s given'; |
| 30 | 30 | throw new \InvalidArgumentException(\sprintf($error, \gettype($field))); |
| 31 | 31 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function query(): Query |
| 44 | 44 | { |
| 45 | - if (! $this instanceof EntityRepository) { |
|
| 45 | + if (!$this instanceof EntityRepository) { |
|
| 46 | 46 | $error = 'Could not use %s under non-repository class, but %s given'; |
| 47 | 47 | throw new \LogicException(\sprintf($error, Hydrogen::class, static::class)); |
| 48 | 48 | } |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | public function __get(string $key): HigherOrderCollectionProxy |
| 122 | 122 | { |
| 123 | - if (! \in_array($key, static::$proxies, true)) { |
|
| 123 | + if (!\in_array($key, static::$proxies, true)) { |
|
| 124 | 124 | $error = "Property [{$key}] does not exist on this collection instance."; |
| 125 | 125 | throw new \InvalidArgumentException($error); |
| 126 | 126 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | $expression = $this->getDoctrineExpression($having, $builder->expr(), $having->getField()); |
| 29 | 29 | |
| 30 | - yield from $this->extractResult($expression, function ($expr) use ($having, $builder) { |
|
| 30 | + yield from $this->extractResult($expression, function($expr) use ($having, $builder) { |
|
| 31 | 31 | if ($having->isAnd()) { |
| 32 | 32 | $builder->andHaving($expr); |
| 33 | 33 | } else { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $processor = $this->getRepository()->getProcessor(); |
| 29 | 29 | |
| 30 | 30 | if (\count($fields)) { |
| 31 | - return \collect($processor->getArrayResult($this))->map(function (array $data) use ($fields) { |
|
| 31 | + return \collect($processor->getArrayResult($this))->map(function(array $data) use ($fields) { |
|
| 32 | 32 | if (\count($fields)) { |
| 33 | 33 | return Arr::only($data, $fields); |
| 34 | 34 | } |
@@ -68,22 +68,22 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | switch ($typeOf) { |
| 70 | 70 | case 'callable': |
| 71 | - return function (callable $applicator = null) use ($result) { |
|
| 71 | + return function(callable $applicator = null) use ($result) { |
|
| 72 | 72 | return ($applicator ?? '\\value')($result); |
| 73 | 73 | }; |
| 74 | 74 | |
| 75 | 75 | case 'object': |
| 76 | - return (object)$result; |
|
| 76 | + return (object) $result; |
|
| 77 | 77 | |
| 78 | 78 | case 'array': |
| 79 | 79 | case 'iterable': |
| 80 | - return (array)$result; |
|
| 80 | + return (array) $result; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $function = $typeOf . 'val'; |
|
| 83 | + $function = $typeOf.'val'; |
|
| 84 | 84 | |
| 85 | - if (! \function_exists($function)) { |
|
| 86 | - throw new \InvalidArgumentException('Could not cast to type ' . $typeOf); |
|
| 85 | + if (!\function_exists($function)) { |
|
| 86 | + throw new \InvalidArgumentException('Could not cast to type '.$typeOf); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return $function($result); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function count(?string $field = 'id'): int |
| 98 | 98 | { |
| 99 | - return $this->select('COUNT(' . $field . ') AS __count') |
|
| 99 | + return $this->select('COUNT('.$field.') AS __count') |
|
| 100 | 100 | ->scalar('__count', 'int'); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function sum(string $field = null): int |
| 109 | 109 | { |
| 110 | - return $this->select('SUM(' . $field . ') AS __sum') |
|
| 110 | + return $this->select('SUM('.$field.') AS __sum') |
|
| 111 | 111 | ->scalar('__sum', 'int'); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function avg(string $field = null): int |
| 120 | 120 | { |
| 121 | - return $this->select('AVG(' . $field . ') AS __avg') |
|
| 121 | + return $this->select('AVG('.$field.') AS __avg') |
|
| 122 | 122 | ->scalar('__avg', 'int'); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function max(string $field = null): int |
| 131 | 131 | { |
| 132 | - return $this->select('MAX(' . $field . ') AS __max') |
|
| 132 | + return $this->select('MAX('.$field.') AS __max') |
|
| 133 | 133 | ->scalar('__max', 'int'); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function min(string $field = null): int |
| 142 | 142 | { |
| 143 | - return $this->select('MIN(' . $field . ') AS __min') |
|
| 143 | + return $this->select('MIN('.$field.') AS __min') |
|
| 144 | 144 | ->scalar('__min', 'int'); |
| 145 | 145 | } |
| 146 | 146 | |