@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function all($columns = ['*']) : Collection |
| 8 | 8 | { |
| 9 | - if (! $this->isCachable()) { |
|
| 9 | + if (!$this->isCachable()) { |
|
| 10 | 10 | $this->model->disableModelCaching(); |
| 11 | 11 | } |
| 12 | 12 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | $option = $this->option('model'); |
| 14 | 14 | |
| 15 | - if (! $option) { |
|
| 15 | + if (!$option) { |
|
| 16 | 16 | return $this->flushEntireCache(); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $usesCachableTrait = $this->getAllTraitsUsedByClass($option) |
| 37 | 37 | ->contains("GeneaLabs\LaravelModelCaching\Traits\Cachable"); |
| 38 | 38 | |
| 39 | - if (! $usesCachableTrait) { |
|
| 39 | + if (!$usesCachableTrait) { |
|
| 40 | 40 | $this->error("'{$option}' is not an instance of CachedModel."); |
| 41 | 41 | $this->line("Only CachedModel instances can be flushed."); |
| 42 | 42 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $tags = collect($this->eagerLoad) |
| 30 | 30 | ->keys() |
| 31 | - ->map(function ($relationName) { |
|
| 31 | + ->map(function($relationName) { |
|
| 32 | 32 | $relation = $this->getRelation($relationName); |
| 33 | 33 | |
| 34 | 34 | return $this->getCachePrefix() |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | protected function getRelation(string $relationName) : Relation |
| 54 | 54 | { |
| 55 | 55 | return collect(explode('.', $relationName)) |
| 56 | - ->reduce(function ($carry, $name) { |
|
| 56 | + ->reduce(function($carry, $name) { |
|
| 57 | 57 | $carry = $carry ?: $this->model; |
| 58 | 58 | $carry = $this->getRelatedModel($carry); |
| 59 | 59 | |
@@ -22,22 +22,22 @@ discard block |
||
| 22 | 22 | $key = $instance->makeCacheKey(); |
| 23 | 23 | |
| 24 | 24 | return $instance->cache($tags) |
| 25 | - ->rememberForever($key, function () use ($columns) { |
|
| 25 | + ->rememberForever($key, function() use ($columns) { |
|
| 26 | 26 | return parent::all($columns); |
| 27 | 27 | }); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public static function bootCachable() |
| 31 | 31 | { |
| 32 | - static::created(function ($instance) { |
|
| 32 | + static::created(function($instance) { |
|
| 33 | 33 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | - static::deleted(function ($instance) { |
|
| 36 | + static::deleted(function($instance) { |
|
| 37 | 37 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - static::saved(function ($instance) { |
|
| 40 | + static::saved(function($instance) { |
|
| 41 | 41 | $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 42 | 42 | }); |
| 43 | 43 | |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | // $instance->checkCooldownAndFlushAfterPersisting($instance); |
| 47 | 47 | // }); |
| 48 | 48 | |
| 49 | - static::pivotAttached(function ($instance, $secondInstance, $relationship) { |
|
| 49 | + static::pivotAttached(function($instance, $secondInstance, $relationship) { |
|
| 50 | 50 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | - static::pivotDetached(function ($instance, $secondInstance, $relationship) { |
|
| 53 | + static::pivotDetached(function($instance, $secondInstance, $relationship) { |
|
| 54 | 54 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - static::pivotUpdated(function ($instance, $secondInstance, $relationship) { |
|
| 57 | + static::pivotUpdated(function($instance, $secondInstance, $relationship) { |
|
| 58 | 58 | $instance->checkCooldownAndFlushAfterPersisting($instance, $relationship); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function newEloquentBuilder($query) |
| 72 | 72 | { |
| 73 | - if (! $this->isCachable()) { |
|
| 73 | + if (!$this->isCachable()) { |
|
| 74 | 74 | $this->isCachable = false; |
| 75 | 75 | |
| 76 | 76 | return new EloquentBuilder($query); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | EloquentBuilder $query, |
| 115 | 115 | int $seconds = null |
| 116 | 116 | ) : EloquentBuilder { |
| 117 | - if (! $seconds) { |
|
| 117 | + if (!$seconds) { |
|
| 118 | 118 | $seconds = $this->cacheCooldownSeconds; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:seconds"; |
| 124 | 124 | |
| 125 | 125 | $this->cache() |
| 126 | - ->rememberForever($cacheKey, function () use ($seconds) { |
|
| 126 | + ->rememberForever($cacheKey, function() use ($seconds) { |
|
| 127 | 127 | return $seconds; |
| 128 | 128 | }); |
| 129 | 129 | |
| 130 | 130 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:invalidated-at"; |
| 131 | 131 | $this->cache() |
| 132 | - ->rememberForever($cacheKey, function () { |
|
| 132 | + ->rememberForever($cacheKey, function() { |
|
| 133 | 133 | return (new Carbon)->now(); |
| 134 | 134 | }); |
| 135 | 135 | |
@@ -43,9 +43,9 @@ |
||
| 43 | 43 | $class = get_called_class(); |
| 44 | 44 | $instance = new $class; |
| 45 | 45 | |
| 46 | - if (!$instance->isCachable()) { |
|
| 47 | - return parent::all($columns); |
|
| 48 | - } |
|
| 46 | + if (!$instance->isCachable()) { |
|
| 47 | + return parent::all($columns); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | $tags = $instance->makeCacheTags(); |
| 51 | 51 | $key = $instance->makeCacheKey(); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | { |
| 8 | 8 | public function avg($column) |
| 9 | 9 | { |
| 10 | - if (! $this->isCachable()) { |
|
| 10 | + if (!$this->isCachable()) { |
|
| 11 | 11 | return parent::avg($column); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function count($columns = "*") |
| 20 | 20 | { |
| 21 | - if (! $this->isCachable()) { |
|
| 21 | + if (!$this->isCachable()) { |
|
| 22 | 22 | return parent::count($columns); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function find($id, $columns = ["*"]) |
| 50 | 50 | { |
| 51 | - if (! $this->isCachable()) { |
|
| 51 | + if (!$this->isCachable()) { |
|
| 52 | 52 | return parent::find($id, $columns); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function first($columns = ["*"]) |
| 66 | 66 | { |
| 67 | - if (! $this->isCachable()) { |
|
| 67 | + if (!$this->isCachable()) { |
|
| 68 | 68 | return parent::first($columns); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | public function get($columns = ["*"]) |
| 85 | 85 | { |
| 86 | - if (! $this->isCachable()) { |
|
| 86 | + if (!$this->isCachable()) { |
|
| 87 | 87 | return parent::get($columns); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function max($column) |
| 118 | 118 | { |
| 119 | - if (! $this->isCachable()) { |
|
| 119 | + if (!$this->isCachable()) { |
|
| 120 | 120 | return parent::max($column); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function min($column) |
| 129 | 129 | { |
| 130 | - if (! $this->isCachable()) { |
|
| 130 | + if (!$this->isCachable()) { |
|
| 131 | 131 | return parent::min($column); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $pageName = "page", |
| 143 | 143 | $page = null |
| 144 | 144 | ) { |
| 145 | - if (! $this->isCachable()) { |
|
| 145 | + if (!$this->isCachable()) { |
|
| 146 | 146 | return parent::paginate($perPage, $columns, $pageName, $page); |
| 147 | 147 | } |
| 148 | 148 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $result = ""; |
| 164 | 164 | |
| 165 | 165 | foreach ($items as $key => $value) { |
| 166 | - $result .= $glue . $key . $glue . $value; |
|
| 166 | + $result .= $glue.$key.$glue.$value; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | return $result; |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | public function pluck($column, $key = null) |
| 173 | 173 | { |
| 174 | - if (! $this->isCachable()) { |
|
| 174 | + if (!$this->isCachable()) { |
|
| 175 | 175 | return parent::pluck($column, $key); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : ""); |
|
| 178 | + $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : ""); |
|
| 179 | 179 | $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator); |
| 180 | 180 | |
| 181 | 181 | return $this->cachedValue(func_get_args(), $cacheKey); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | public function sum($column) |
| 185 | 185 | { |
| 186 | - if (! $this->isCachable()) { |
|
| 186 | + if (!$this->isCachable()) { |
|
| 187 | 187 | return parent::sum($column); |
| 188 | 188 | } |
| 189 | 189 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | public function value($column) |
| 203 | 203 | { |
| 204 | - if (! $this->isCachable()) { |
|
| 204 | + if (!$this->isCachable()) { |
|
| 205 | 205 | return parent::value($column); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | return $this->cache($cacheTags) |
| 277 | 277 | ->rememberForever( |
| 278 | 278 | $hashedCacheKey, |
| 279 | - function () use ($arguments, $cacheKey, $method) { |
|
| 279 | + function() use ($arguments, $cacheKey, $method) { |
|
| 280 | 280 | return [ |
| 281 | 281 | "key" => $cacheKey, |
| 282 | 282 | "value" => parent::{$method}(...$arguments), |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | ->get("laravel-model-caching.use-database-keying"); |
| 13 | 13 | |
| 14 | 14 | if ($useDatabaseKeying) { |
| 15 | - $cachePrefix .= $this->getConnectionName() . ":"; |
|
| 16 | - $cachePrefix .= $this->getDatabaseName() . ":"; |
|
| 15 | + $cachePrefix .= $this->getConnectionName().":"; |
|
| 16 | + $cachePrefix .= $this->getDatabaseName().":"; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | $cachePrefix .= Container::getInstance() |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | if ($this->model |
| 24 | 24 | && property_exists($this->model, "cachePrefix") |
| 25 | 25 | ) { |
| 26 | - $cachePrefix .= $this->model->cachePrefix . ":"; |
|
| 26 | + $cachePrefix .= $this->model->cachePrefix.":"; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return $cachePrefix; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function boot() |
| 13 | 13 | { |
| 14 | - $configPath = __DIR__ . '/../../config/laravel-model-caching.php'; |
|
| 14 | + $configPath = __DIR__.'/../../config/laravel-model-caching.php'; |
|
| 15 | 15 | $this->mergeConfigFrom($configPath, 'laravel-model-caching'); |
| 16 | 16 | $this->commands([ |
| 17 | 17 | Clear::class, |
@@ -34,18 +34,18 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | protected function applyScopesToInstance() |
| 36 | 36 | { |
| 37 | - if (! property_exists($this, "scopes") |
|
| 37 | + if (!property_exists($this, "scopes") |
|
| 38 | 38 | || $this->scopesAreApplied |
| 39 | 39 | ) { |
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | foreach ($this->scopes as $identifier => $scope) { |
| 44 | - if (! isset($this->scopes[$identifier])) { |
|
| 44 | + if (!isset($this->scopes[$identifier])) { |
|
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->callScope(function () use ($scope) { |
|
| 48 | + $this->callScope(function() use ($scope) { |
|
| 49 | 49 | if ($scope instanceof Closure) { |
| 50 | 50 | $scope($this); |
| 51 | 51 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 104 | 104 | |
| 105 | 105 | $this->cache() |
| 106 | - ->rememberForever($cacheKey, function () { |
|
| 106 | + ->rememberForever($cacheKey, function() { |
|
| 107 | 107 | return (new Carbon)->now(); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | public function getModelCacheCooldown(Model $instance) : array |
| 182 | 182 | { |
| 183 | - if (! $instance->cacheCooldownSeconds) { |
|
| 183 | + if (!$instance->cacheCooldownSeconds) { |
|
| 184 | 184 | return [null, null, null]; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | [$cacheCooldown, $invalidatedAt, $savedAt] = $this |
| 190 | 190 | ->getCacheCooldownDetails($instance, $cachePrefix, $modelClassName); |
| 191 | 191 | |
| 192 | - if (! $cacheCooldown || $cacheCooldown === 0) { |
|
| 192 | + if (!$cacheCooldown || $cacheCooldown === 0) { |
|
| 193 | 193 | return [null, null, null]; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | { |
| 219 | 219 | [$cacheCooldown, $invalidatedAt] = $this->getModelCacheCooldown($instance); |
| 220 | 220 | |
| 221 | - if (! $cacheCooldown |
|
| 221 | + if (!$cacheCooldown |
|
| 222 | 222 | || (new Carbon)->now()->diffInSeconds($invalidatedAt) < $cacheCooldown |
| 223 | 223 | ) { |
| 224 | 224 | return; |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | [$cacheCooldown, $invalidatedAt] = $instance->getModelCacheCooldown($instance); |
| 245 | 245 | |
| 246 | - if (! $cacheCooldown) { |
|
| 246 | + if (!$cacheCooldown) { |
|
| 247 | 247 | $instance->flushCache(); |
| 248 | 248 | |
| 249 | 249 | if ($relationship) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | |
| 271 | 271 | public function isCachable() : bool |
| 272 | 272 | { |
| 273 | - $isCacheDisabled = ! Container::getInstance() |
|
| 273 | + $isCacheDisabled = !Container::getInstance() |
|
| 274 | 274 | ->make("config") |
| 275 | 275 | ->get("laravel-model-caching.enabled"); |
| 276 | 276 | $allRelationshipsAreCachable = true; |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | $allRelationshipsAreCachable = collect($this |
| 282 | 282 | ->eagerLoad) |
| 283 | 283 | ->keys() |
| 284 | - ->reduce(function ($carry, $related) { |
|
| 285 | - if (! method_exists($this, $related) |
|
| 284 | + ->reduce(function($carry, $related) { |
|
| 285 | + if (!method_exists($this, $related) |
|
| 286 | 286 | || $carry === false |
| 287 | 287 | ) { |
| 288 | 288 | return $carry; |
@@ -290,8 +290,8 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | $relatedModel = $this->model->$related()->getRelated(); |
| 292 | 292 | |
| 293 | - if (! method_exists($relatedModel, "isCachable") |
|
| 294 | - || ! $relatedModel->isCachable() |
|
| 293 | + if (!method_exists($relatedModel, "isCachable") |
|
| 294 | + || !$relatedModel->isCachable() |
|
| 295 | 295 | ) { |
| 296 | 296 | return false; |
| 297 | 297 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | return $this->isCachable |
| 305 | - && ! $isCacheDisabled |
|
| 305 | + && !$isCacheDisabled |
|
| 306 | 306 | && $allRelationshipsAreCachable; |
| 307 | 307 | } |
| 308 | 308 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | $cacheKey = "{$cachePrefix}:{$modelClassName}-cooldown:saved-at"; |
| 314 | 314 | |
| 315 | 315 | $instance->cache() |
| 316 | - ->rememberForever($cacheKey, function () { |
|
| 316 | + ->rememberForever($cacheKey, function() { |
|
| 317 | 317 | return (new Carbon)->now(); |
| 318 | 318 | }); |
| 319 | 319 | } |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | protected function getLimitClause() : string |
| 59 | 59 | { |
| 60 | - if (! property_exists($this->query, "limit") |
|
| 61 | - || ! $this->query->limit |
|
| 60 | + if (!property_exists($this->query, "limit") |
|
| 61 | + || !$this->query->limit |
|
| 62 | 62 | ) { |
| 63 | 63 | return ""; |
| 64 | 64 | } |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | protected function getOffsetClause() : string |
| 81 | 81 | { |
| 82 | - if (! property_exists($this->query, "offset") |
|
| 83 | - || ! $this->query->offset |
|
| 82 | + if (!property_exists($this->query, "offset") |
|
| 83 | + || !$this->query->offset |
|
| 84 | 84 | ) { |
| 85 | 85 | return ""; |
| 86 | 86 | } |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | protected function getOrderByClauses() : string |
| 92 | 92 | { |
| 93 | - if (! property_exists($this->query, "orders") |
|
| 94 | - || ! $this->query->orders |
|
| 93 | + if (!property_exists($this->query, "orders") |
|
| 94 | + || !$this->query->orders |
|
| 95 | 95 | ) { |
| 96 | 96 | return ""; |
| 97 | 97 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | $orders = collect($this->query->orders); |
| 100 | 100 | |
| 101 | 101 | return $orders |
| 102 | - ->reduce(function ($carry, $order) { |
|
| 102 | + ->reduce(function($carry, $order) { |
|
| 103 | 103 | if (($order["type"] ?? "") === "Raw") { |
| 104 | - return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]); |
|
| 104 | + return $carry."_orderByRaw_".(new Str)->slug($order["sql"]); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"]; |
|
| 107 | + return $carry."_orderBy_".$order["column"]."_".$order["direction"]; |
|
| 108 | 108 | }) |
| 109 | 109 | ?: ""; |
| 110 | 110 | } |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | if (($columns === ["*"] |
| 115 | 115 | || $columns === []) |
| 116 | - && (! property_exists($this->query, "columns") |
|
| 117 | - || ! $this->query->columns) |
|
| 116 | + && (!property_exists($this->query, "columns") |
|
| 117 | + || !$this->query->columns) |
|
| 118 | 118 | ) { |
| 119 | 119 | return ""; |
| 120 | 120 | } |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | if (property_exists($this->query, "columns") |
| 123 | 123 | && $this->query->columns |
| 124 | 124 | ) { |
| 125 | - return "_" . implode("_", $this->query->columns); |
|
| 125 | + return "_".implode("_", $this->query->columns); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - return "_" . implode("_", $columns); |
|
| 128 | + return "_".implode("_", $columns); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | protected function getTypeClause($where) : string |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | protected function getValuesClause(array $where = []) : string |
| 141 | 141 | { |
| 142 | - if (! $where |
|
| 142 | + if (!$where |
|
| 143 | 143 | || in_array($where["type"], ["NotNull", "Null"]) |
| 144 | 144 | ) { |
| 145 | 145 | return ""; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $values = $this->getValuesFromWhere($where); |
| 149 | 149 | $values = $this->getValuesFromBindings($where, $values); |
| 150 | 150 | |
| 151 | - return "_" . $values; |
|
| 151 | + return "_".$values; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | protected function getValuesFromWhere(array $where) : string |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $this->currentBinding++; |
| 179 | 179 | |
| 180 | 180 | if ($where["type"] === "between") { |
| 181 | - $values .= "_" . $this->query->bindings["where"][$this->currentBinding]; |
|
| 181 | + $values .= "_".$this->query->bindings["where"][$this->currentBinding]; |
|
| 182 | 182 | $this->currentBinding++; |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | protected function getWhereClauses(array $wheres = []) : string |
| 196 | 196 | { |
| 197 | - return "" . $this->getWheres($wheres) |
|
| 198 | - ->reduce(function ($carry, $where) { |
|
| 197 | + return "".$this->getWheres($wheres) |
|
| 198 | + ->reduce(function($carry, $where) { |
|
| 199 | 199 | $value = $carry; |
| 200 | 200 | $value .= $this->getNestedClauses($where); |
| 201 | 201 | $value .= $this->getColumnClauses($where); |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | protected function getNestedClauses(array $where) : string |
| 211 | 211 | { |
| 212 | - if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 212 | + if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) { |
|
| 213 | 213 | return ""; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres); |
|
| 216 | + return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | protected function getColumnClauses(array $where) : string |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | protected function getInAndNotInClauses(array $where) : string |
| 229 | 229 | { |
| 230 | - if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 230 | + if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) { |
|
| 231 | 231 | return ""; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $this->currentBinding += count($where["values"]); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) { |
|
| 242 | + if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) { |
|
| 243 | 243 | try { |
| 244 | 244 | $subquery = Uuid::fromBytes($subquery); |
| 245 | 245 | $values = $this->recursiveImplode([$subquery], "_"); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | continue; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $result .= $glue . $value; |
|
| 280 | + $result .= $glue.$value; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | return $result; |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | protected function getRawClauses(array $where) : string |
| 287 | 287 | { |
| 288 | - if (! in_array($where["type"], ["raw"])) { |
|
| 288 | + if (!in_array($where["type"], ["raw"])) { |
|
| 289 | 289 | return ""; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $clause = "_{$where["boolean"]}"; |
| 294 | 294 | |
| 295 | 295 | while (count($queryParts) > 1) { |
| 296 | - $clause .= "_" . array_shift($queryParts); |
|
| 296 | + $clause .= "_".array_shift($queryParts); |
|
| 297 | 297 | $clause .= $this->query->bindings["where"][$this->currentBinding]; |
| 298 | 298 | $this->currentBinding++; |
| 299 | 299 | } |
@@ -301,10 +301,10 @@ discard block |
||
| 301 | 301 | $lastPart = array_shift($queryParts); |
| 302 | 302 | |
| 303 | 303 | if ($lastPart) { |
| 304 | - $clause .= "_" . $lastPart; |
|
| 304 | + $clause .= "_".$lastPart; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - return "-" . str_replace(" ", "_", $clause); |
|
| 307 | + return "-".str_replace(" ", "_", $clause); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | protected function getOtherClauses(array $where) : string |
@@ -340,8 +340,8 @@ discard block |
||
| 340 | 340 | return ""; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - return $eagerLoads->keys()->reduce(function ($carry, $related) { |
|
| 344 | - if (! method_exists($this->model, $related)) { |
|
| 343 | + return $eagerLoads->keys()->reduce(function($carry, $related) { |
|
| 344 | + if (!method_exists($this->model, $related)) { |
|
| 345 | 345 | return "{$carry}-{$related}"; |
| 346 | 346 | } |
| 347 | 347 | |