Passed
Push — master ( a05d4a...8f3386 )
by
unknown
02:32
created
src/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('visits'))
3
+if (!function_exists('visits'))
4 4
 {
5 5
     function visits($subject, $tag = 'visits')
6 6
     {
Please login to merge, or discard this patch.
src/Traits/Lists.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $cachedList = $this->cachedList($limit, $cacheKey);
18 18
         $visitsIds = $this->getVisitsIds($limit, $this->keys->visits, $isLow);
19 19
 
20
-        if($visitsIds === $cachedList->pluck($this->keys->primary)->toArray() && ! $this->fresh) {
20
+        if ($visitsIds === $cachedList->pluck($this->keys->primary)->toArray() && !$this->fresh) {
21 21
             return $cachedList;
22 22
         }
23 23
 
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
 
91 91
             return ($this->subject)::whereIn($this->keys->primary, $visitsIds)
92 92
                 ->get()
93
-                ->sortBy(function ($subject) use ($visitsIds) {
93
+                ->sortBy(function($subject) use ($visitsIds) {
94 94
                     return array_search($subject->{$this->keys->primary}, $visitsIds);
95
-                })->each(function ($subject) use ($cacheKey) {
95
+                })->each(function($subject) use ($cacheKey) {
96 96
                     $this->redis->rpush($cacheKey, serialize($subject));
97 97
                 });
98 98
         }
Please login to merge, or discard this patch.
src/Traits/Record.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/VisitsServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Visits.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function by($subject)
93 93
     {
94
-        if($subject instanceof Model) {
94
+        if ($subject instanceof Model) {
95 95
             $this->keys->append($this->keys->modelName($subject), $subject->{$subject->getKeyName()});
96 96
         } else if (is_array($subject)) {
97 97
             $this->keys->append(array_keys($subject)[0], Arr::first($subject));
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public function recordedIp()
122 122
     {
123
-        return ! $this->redis->set($this->keys->ip(request()->ip()), true, 'EX', $this->ipSeconds, 'NX');
123
+        return !$this->redis->set($this->keys->ip(request()->ip()), true, 'EX', $this->ipSeconds, 'NX');
124 124
     }
125 125
 
126 126
     /**
@@ -143,8 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
         return intval(
145 145
             $this->keys->instanceOfModel ?
146
-                $this->redis->zscore($this->keys->visits, $this->keys->id) :
147
-                $this->redis->get($this->keys->visitsTotal())
146
+                $this->redis->zscore($this->keys->visits, $this->keys->id) : $this->redis->get($this->keys->visitsTotal())
148 147
         );
149 148
     }
150 149
 
@@ -185,14 +184,14 @@  discard block
 block discarded – undo
185 184
             $this->redis->zincrby($this->keys->visits, $inc, $this->keys->id);
186 185
             $this->redis->incrby($this->keys->visitsTotal(), $inc);
187 186
 
188
-            if(is_array($this->globalIgnore) && sizeof($this->globalIgnore) > 0) {
187
+            if (is_array($this->globalIgnore) && sizeof($this->globalIgnore) > 0) {
189 188
                 $ignore = array_merge($ignore, $this->globalIgnore);
190 189
             }
191 190
 
192 191
             //NOTE: $$method is parameter also .. ($periods,$country,$refer)
193 192
             foreach (['country', 'refer', 'periods', 'operatingSystem', 'language'] as $method) {
194
-                if(! in_array($method, $ignore))  {
195
-                    $this->{'record'.studly_case($method)}($inc);
193
+                if (!in_array($method, $ignore)) {
194
+                    $this->{'record' . studly_case($method)}($inc);
196 195
                 }
197 196
             }
198 197
         }
Please login to merge, or discard this patch.