Passed
Branch master (57bcb0)
by Nur
10:07
created
Category
database/migrations/0000_00_00_000000_create_counters_tables.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     public function up()
15 15
     {
16 16
 
17
-        Schema::create('counters', function (Blueprint $table) {
17
+        Schema::create('counters', function(Blueprint $table) {
18 18
             $table->id();
19 19
             $table->string('key')->unique();
20 20
             $table->string('name');
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             $table->timestamps();
26 26
         });
27 27
 
28
-        Schema::create('counterables', function (Blueprint $table) {
28
+        Schema::create('counterables', function(Blueprint $table) {
29 29
             $table->id();
30 30
             $table->morphs('counterable');
31 31
             $table->unsignedBigInteger('counter_id');
Please login to merge, or discard this patch.
src/Traits/HasCounter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 //        dd($this->counters);
35 35
         $counter = $this->counters->where('key', $key)->first();
36 36
         //connect the counter to the object if it's not exist
37
-        if (! $counter) {
37
+        if (!$counter) {
38 38
             $this->addCounter($key);
39 39
             $counter = $this->counters->where('key', $key)->first();
40 40
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function hasCounter($key)
51 51
     {
52
-        return ! is_null($this->counters()->where('counters.key', $key)->first());
52
+        return !is_null($this->counters()->where('counters.key', $key)->first());
53 53
     }
54 54
 
55 55
     /**
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $counter = Counters::get($key);
79 79
         if ($counter) {
80
-            if (! $this->hasCounter($key)) { // not to add the counter twice
80
+            if (!$this->hasCounter($key)) { // not to add the counter twice
81 81
                 $this->counters()->attach(
82 82
                     $counter->id, [
83
-                        'value' => ! is_null($initialValue) ? $initialValue : $counter->initial_value,
83
+                        'value' => !is_null($initialValue) ? $initialValue : $counter->initial_value,
84 84
                     ]
85 85
                 );
86 86
             } else {
Please login to merge, or discard this patch.
src/Classes/Counters.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $counter = Counter::query()->where('key', $key)->first();
59 59
         if ($counter) {
60 60
             return $counter->value;
61
-        } elseif (! is_null($default)) {
61
+        } elseif (!is_null($default)) {
62 62
             return $default;
63 63
         } else {
64 64
             throw CounterDoesNotExist::create($key);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function incrementIfNotHasCookies($key, $step = null)
141 141
     {
142 142
         $cookieName = $this->getCookieName($key);
143
-        if (! array_key_exists($cookieName, $_COOKIE)) {
143
+        if (!array_key_exists($cookieName, $_COOKIE)) {
144 144
             $this->increment($key, $step);
145 145
             setcookie($cookieName, 1);
146 146
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     public function decrementIfNotHasCookies($key, $step = null)
156 156
     {
157 157
         $cookieName = $this->getCookieName($key);
158
-        if (! array_key_exists($cookieName, $_COOKIE)) {
158
+        if (!array_key_exists($cookieName, $_COOKIE)) {
159 159
             $this->decrement($key, $step);
160 160
             setcookie($cookieName, 1);
161 161
         }
Please login to merge, or discard this patch.
src/CountersServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     public function boot()
17 17
     {
18 18
 
19
-        $this->app->booted(function () {
19
+        $this->app->booted(function() {
20 20
             $loader = AliasLoader::getInstance();
21 21
             $loader->alias('Counters', Counters::class);
22 22
         });
Please login to merge, or discard this patch.
src/Models/Counterable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
     ];
39 39
 
40 40
 
41
-    public function counter(){
41
+    public function counter() {
42 42
         return $this->belongsTo(Counter::class);
43 43
     }
44 44
 }
Please login to merge, or discard this patch.
src/Models/Counter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@
 block discarded – undo
47 47
         'step',
48 48
     ];
49 49
 
50
-    public function getIncrementUrl(){
50
+    public function getIncrementUrl() {
51 51
         return Counters::getIncrementUrl($this->key);
52 52
     }
53 53
 
54
-    public function getDecrementUrl(){
54
+    public function getDecrementUrl() {
55 55
         return Counters::getDecrementUrl($this->key);
56 56
     }
57 57
 
Please login to merge, or discard this patch.