@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function by($subject) |
87 | 87 | { |
88 | - if($subject instanceof Model) { |
|
88 | + if ($subject instanceof Model) { |
|
89 | 89 | $this->keys->append($this->keys->modelName($subject), $subject->{$subject->getKeyName()}); |
90 | 90 | } else if (is_array($subject)) { |
91 | 91 | $this->keys->append(array_keys($subject)[0], array_first($subject)); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function recordedIp() |
116 | 116 | { |
117 | - return ! $this->redis->set($this->keys->ip(request()->ip()), true, 'EX', $this->ipSeconds, 'NX'); |
|
117 | + return !$this->redis->set($this->keys->ip(request()->ip()), true, 'EX', $this->ipSeconds, 'NX'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -137,8 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | return intval( |
139 | 139 | $this->keys->instanceOfModel ? |
140 | - $this->redis->zscore($this->keys->visits, $this->keys->id) : |
|
141 | - $this->redis->get($this->keys->visitsTotal()) |
|
140 | + $this->redis->zscore($this->keys->visits, $this->keys->id) : $this->redis->get($this->keys->visitsTotal()) |
|
142 | 141 | ); |
143 | 142 | } |
144 | 143 | |
@@ -183,8 +182,8 @@ discard block |
||
183 | 182 | |
184 | 183 | //NOTE: $$method is parameter also .. ($periods,$country,$refer) |
185 | 184 | foreach (['country', 'refer', 'periods', 'operatingSystem', 'language'] as $method) { |
186 | - if(! in_array($method, $ignore)) { |
|
187 | - $this->{'record'.studly_case($method)}($inc); |
|
185 | + if (!in_array($method, $ignore)) { |
|
186 | + $this->{'record' . studly_case($method)}($inc); |
|
188 | 187 | } |
189 | 188 | } |
190 | 189 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | protected function recordCountry($inc) |
13 | 13 | { |
14 | - $this->redis->zincrby($this->keys->visits."_countries:{$this->keys->id}", $inc, $this->getVisitorCountry()); |
|
14 | + $this->redis->zincrby($this->keys->visits . "_countries:{$this->keys->id}", $inc, $this->getVisitorCountry()); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected function recordRefer($inc) |
21 | 21 | { |
22 | 22 | $referer = app(Referer::class)->get(); |
23 | - $this->redis->zincrby($this->keys->visits."_referers:{$this->keys->id}", $inc, $referer); |
|
23 | + $this->redis->zincrby($this->keys->visits . "_referers:{$this->keys->id}", $inc, $referer); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | protected function recordOperatingSystem($inc) |
30 | 30 | { |
31 | - $this->redis->zincrby($this->keys->visits."_OSes:{$this->keys->id}", $inc, $this->getVisitorOperatingSystem()); |
|
31 | + $this->redis->zincrby($this->keys->visits . "_OSes:{$this->keys->id}", $inc, $this->getVisitorOperatingSystem()); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function recordLanguage($inc) |
38 | 38 | { |
39 | - $this->redis->zincrby($this->keys->visits."_languages:{$this->keys->id}", $inc, $this->getVisitorLanguage()); |
|
39 | + $this->redis->zincrby($this->keys->visits . "_languages:{$this->keys->id}", $inc, $this->getVisitorLanguage()); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $periodKey = $this->keys->period($period); |
49 | 49 | |
50 | 50 | $this->redis->zincrby($periodKey, $inc, $this->keys->id); |
51 | - $this->redis->incrby($periodKey.'_total', $inc); |
|
51 | + $this->redis->incrby($periodKey . '_total', $inc); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 |
@@ -15,10 +15,10 @@ discard block |
||
15 | 15 | public function boot() |
16 | 16 | { |
17 | 17 | $this->publishes([ |
18 | - __DIR__.'/config/visits.php' => config_path('visits.php'), |
|
18 | + __DIR__ . '/config/visits.php' => config_path('visits.php'), |
|
19 | 19 | ], 'config'); |
20 | 20 | |
21 | - Carbon::macro('endOfxHours', function ($xhours) { |
|
21 | + Carbon::macro('endOfxHours', function($xhours) { |
|
22 | 22 | if ($xhours > 12) { |
23 | 23 | throw new \Exception('12 is the maximum period in xHours feature'); |
24 | 24 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function register() |
41 | 41 | { |
42 | 42 | $this->mergeConfigFrom( |
43 | - __DIR__.'/config/visits.php', |
|
43 | + __DIR__ . '/config/visits.php', |
|
44 | 44 | 'visits' |
45 | 45 | ); |
46 | 46 | } |