@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $cachedList = $this->cachedList($limit, $cacheKey); |
| 20 | 20 | $visitsIds = $this->getVisitsIds($limit, $this->keys->visits, $orderByAsc); |
| 21 | 21 | |
| 22 | - if($visitsIds === $cachedList->pluck($this->keys->primary)->toArray() && ! $this->fresh) { |
|
| 22 | + if ($visitsIds === $cachedList->pluck($this->keys->primary)->toArray() && !$this->fresh) { |
|
| 23 | 23 | return $cachedList; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | return ($this->subject)::whereIn($this->keys->primary, $visitsIds) |
| 103 | 103 | ->get() |
| 104 | - ->sortBy(function ($subject) use ($visitsIds) { |
|
| 104 | + ->sortBy(function($subject) use ($visitsIds) { |
|
| 105 | 105 | return array_search($subject->{$this->keys->primary}, $visitsIds); |
| 106 | - })->each(function ($subject) use ($cacheKey) { |
|
| 106 | + })->each(function($subject) use ($cacheKey) { |
|
| 107 | 107 | $this->connection->addToFlatList($cacheKey, serialize($subject)); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ->connect($config['connection']) |
| 76 | 76 | ->setPrefix($config['keys_prefix'] ?? $config['redis_keys_prefix'] ?? 'visits'); |
| 77 | 77 | |
| 78 | - if(! $this->connection) { |
|
| 78 | + if (!$this->connection) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | 'eloquent' => \Awssat\Visits\DataEngines\EloquentEngine::class |
| 98 | 98 | ]; |
| 99 | 99 | |
| 100 | - if(! array_key_exists($name, $connections)) { |
|
| 100 | + if (!array_key_exists($name, $connections)) { |
|
| 101 | 101 | throw new \Exception("(Laravel-Visits) The selected engine `{$name}` is not supported! Please correct this issue from config/visits.php."); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function by($subject) |
| 112 | 112 | { |
| 113 | - if($subject instanceof Model) { |
|
| 113 | + if ($subject instanceof Model) { |
|
| 114 | 114 | $this->keys->append($this->keys->modelName($subject), $subject->{$subject->getKeyName()}); |
| 115 | 115 | } else if (is_array($subject)) { |
| 116 | 116 | $this->keys->append(array_keys($subject)[0], Arr::first($subject)); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function recordedIp() |
| 139 | 139 | { |
| 140 | - if(! $this->connection->exists($this->keys->ip(request()->ip()))) { |
|
| 140 | + if (!$this->connection->exists($this->keys->ip(request()->ip()))) { |
|
| 141 | 141 | $this->connection->set($this->keys->ip(request()->ip()), true); |
| 142 | 142 | $this->connection->setExpiration($this->keys->ip(request()->ip()), $this->ipSeconds); |
| 143 | 143 | |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | public function count() |
| 155 | 155 | { |
| 156 | 156 | if ($this->country) { |
| 157 | - return $this->connection->get($this->keys->visits."_countries:{$this->keys->id}", $this->country); |
|
| 157 | + return $this->connection->get($this->keys->visits . "_countries:{$this->keys->id}", $this->country); |
|
| 158 | 158 | } else if ($this->referer) { |
| 159 | - return $this->connection->get($this->keys->visits."_referers:{$this->keys->id}", $this->referer); |
|
| 159 | + return $this->connection->get($this->keys->visits . "_referers:{$this->keys->id}", $this->referer); |
|
| 160 | 160 | } else if ($this->operatingSystem) { |
| 161 | - return $this->connection->get($this->keys->visits."_OSes:{$this->keys->id}", $this->operatingSystem); |
|
| 161 | + return $this->connection->get($this->keys->visits . "_OSes:{$this->keys->id}", $this->operatingSystem); |
|
| 162 | 162 | } else if ($this->language) { |
| 163 | - return $this->connection->get($this->keys->visits."_languages:{$this->keys->id}", $this->language); |
|
| 163 | + return $this->connection->get($this->keys->visits . "_languages:{$this->keys->id}", $this->language); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | return intval( |
@@ -202,14 +202,14 @@ discard block |
||
| 202 | 202 | $this->connection->increment($this->keys->visits, $inc, $this->keys->id); |
| 203 | 203 | $this->connection->increment($this->keys->visitsTotal(), $inc); |
| 204 | 204 | |
| 205 | - if(is_array($this->globalIgnore) && sizeof($this->globalIgnore) > 0) { |
|
| 205 | + if (is_array($this->globalIgnore) && sizeof($this->globalIgnore) > 0) { |
|
| 206 | 206 | $ignore = array_merge($ignore, $this->globalIgnore); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | //NOTE: $$method is parameter also .. ($periods,$country,$refer) |
| 210 | 210 | foreach (['country', 'refer', 'periods', 'operatingSystem', 'language'] as $method) { |
| 211 | - if(! in_array($method, $ignore)) { |
|
| 212 | - $this->{'record'.Str::studly($method)}($inc); |
|
| 211 | + if (!in_array($method, $ignore)) { |
|
| 212 | + $this->{'record' . Str::studly($method)}($inc); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |