@@ -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 |