@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use Cassandra\Rows; |
6 | 6 | use lroman242\LaravelCassandra\Eloquent\Model; |
7 | -use LogicException; |
|
8 | 7 | use Illuminate\Support\Arr; |
9 | 8 | use Illuminate\Contracts\Support\Arrayable; |
10 | 9 | use Illuminate\Database\Eloquent\Collection as BaseCollection; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $dictionary = $this->getDictionary(); |
164 | 164 | |
165 | 165 | foreach ($items as $item) { |
166 | - $dictionary[(string)$item->getKey()] = $item; |
|
166 | + $dictionary[(string) $item->getKey()] = $item; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | return new static(array_values($dictionary), $this->model); |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | ->getDictionary(); |
191 | 191 | |
192 | 192 | return $this->map(function ($model) use ($freshModels) { |
193 | - return $model->exists && isset($freshModels[(string)$model->getKey()]) |
|
194 | - ? $freshModels[(string)$model->getKey()] : null; |
|
193 | + return $model->exists && isset($freshModels[(string) $model->getKey()]) |
|
194 | + ? $freshModels[(string) $model->getKey()] : null; |
|
195 | 195 | }); |
196 | 196 | } |
197 | 197 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $dictionary = $this->getDictionary($items); |
209 | 209 | |
210 | 210 | foreach ($this->items as $item) { |
211 | - if (! isset($dictionary[(string)$item->getKey()])) { |
|
211 | + if (!isset($dictionary[(string) $item->getKey()])) { |
|
212 | 212 | $diff->add($item); |
213 | 213 | } |
214 | 214 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $dictionary = $this->getDictionary($items); |
230 | 230 | |
231 | 231 | foreach ($this->items as $item) { |
232 | - if (isset($dictionary[(string)$item->getKey()])) { |
|
232 | + if (isset($dictionary[(string) $item->getKey()])) { |
|
233 | 233 | $intersect->add($item); |
234 | 234 | } |
235 | 235 | } |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | */ |
247 | 247 | public function unique($key = null, $strict = false) |
248 | 248 | { |
249 | - if (! is_null($key)) { |
|
249 | + if (!is_null($key)) { |
|
250 | 250 | return parent::unique($key, $strict); |
251 | 251 | } |
252 | 252 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $dictionary = []; |
298 | 298 | |
299 | 299 | foreach ($items as $value) { |
300 | - $dictionary[(string)$value->getKey()] = $value; |
|
300 | + $dictionary[(string) $value->getKey()] = $value; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | return $dictionary; |
@@ -64,7 +64,7 @@ |
||
64 | 64 | * Execute the query as a "select" statement. |
65 | 65 | * |
66 | 66 | * @param array $columns |
67 | - * @return \Illuminate\Database\Eloquent\Collection|static[] |
|
67 | + * @return \Illuminate\Database\Eloquent\Model[] |
|
68 | 68 | */ |
69 | 69 | public function get($columns = ['*']) |
70 | 70 | { |
@@ -206,7 +206,7 @@ |
||
206 | 206 | $preparedStatement = $this->session->prepare($query); |
207 | 207 | |
208 | 208 | //Set default page size |
209 | - $defaultOptions = ['page_size' => (int)$this->config['page_size']]; |
|
209 | + $defaultOptions = ['page_size' => (int) $this->config['page_size']]; |
|
210 | 210 | |
211 | 211 | //Merge with custom options |
212 | 212 | $options = array_merge($defaultOptions, $customOptions); |
@@ -108,13 +108,13 @@ |
||
108 | 108 | return $this->getKeyName(); |
109 | 109 | } |
110 | 110 | |
111 | - /** |
|
112 | - * Set a given attribute on the model. |
|
113 | - * |
|
114 | - * @param string $key |
|
115 | - * @param mixed $value |
|
116 | - * @return $this |
|
117 | - */ |
|
111 | + /** |
|
112 | + * Set a given attribute on the model. |
|
113 | + * |
|
114 | + * @param string $key |
|
115 | + * @param mixed $value |
|
116 | + * @return $this |
|
117 | + */ |
|
118 | 118 | public function setAttribute($key, $value) |
119 | 119 | { |
120 | 120 | // First we will check for the presence of a mutator for the set operation |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | // which simply lets the developers tweak the attribute as it is set on |
122 | 122 | // the model, such as "json_encoding" an listing of data for storage. |
123 | 123 | if ($this->hasSetMutator($key)) { |
124 | - $method = 'set'.Str::studly($key).'Attribute'; |
|
124 | + $method = 'set' . Str::studly($key) . 'Attribute'; |
|
125 | 125 | |
126 | 126 | return $this->{$method}($value); |
127 | 127 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $value = $this->fromDateTime($value); |
134 | 134 | } |
135 | 135 | |
136 | - if ($this->isJsonCastable($key) && ! is_null($value)) { |
|
136 | + if ($this->isJsonCastable($key) && !is_null($value)) { |
|
137 | 137 | $value = $this->castAttributeAsJson($key, $value); |
138 | 138 | } |
139 | 139 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | return is_numeric($current) && is_numeric($original) |
208 | - && strcmp((string)$current, (string)$original) === 0; |
|
208 | + && strcmp((string) $current, (string) $original) === 0; |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | //Set up custom options |
117 | 117 | $options = []; |
118 | - if ($this->pageSize !== null && (int)$this->pageSize > 0) { |
|
119 | - $options['page_size'] = (int)$this->pageSize; |
|
118 | + if ($this->pageSize !== null && (int) $this->pageSize > 0) { |
|
119 | + $options['page_size'] = (int) $this->pageSize; |
|
120 | 120 | } |
121 | 121 | if ($this->paginationStateToken !== null) { |
122 | 122 | $options['paging_state_token'] = $this->paginationStateToken; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | protected function runSelect(array $options = []) |
150 | 150 | { |
151 | 151 | return $this->connection->select( |
152 | - $this->toSql(), $this->getBindings(), ! $this->useWritePdo, $options |
|
152 | + $this->toSql(), $this->getBindings(), !$this->useWritePdo, $options |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | public function setPageSize($pageSize = null) |
179 | 179 | { |
180 | 180 | if ($pageSize !== null) { |
181 | - $this->pageSize = (int)$pageSize; |
|
181 | + $this->pageSize = (int) $pageSize; |
|
182 | 182 | } else { |
183 | 183 | $this->pageSize = $pageSize; |
184 | 184 | } |