Passed
Push — master ( ee14e3...5629be )
by Mike
03:09
created
src/CacheTags.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@
 block discarded – undo
8 8
     {
9 9
         return collect($this->eagerLoad)
10 10
             ->keys()
11
-            ->map(function ($relationName) {
11
+            ->map(function($relationName) {
12 12
                 $relation = collect(explode('.', $relationName))
13
-                    ->reduce(function ($carry, $name) {
14
-                        if (! $carry) {
13
+                    ->reduce(function($carry, $name) {
14
+                        if (!$carry) {
15 15
                             $carry = $this->model;
16 16
                         }
17 17
 
Please login to merge, or discard this patch.
src/Providers/Service.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
     public function boot()
11 11
     {
12
-        $configPath = __DIR__ . '/../../config/laravel-model-caching.php';
12
+        $configPath = __DIR__.'/../../config/laravel-model-caching.php';
13 13
         $this->mergeConfigFrom($configPath, 'laravel-model-caching');
14 14
         $this->commands(Flush::class);
15 15
     }
Please login to merge, or discard this patch.
src/CachedBuilder.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function avg($column)
14 14
     {
15
-        if (! $this->isCachable) {
15
+        if (!$this->isCachable) {
16 16
             return parent::avg($column);
17 17
         }
18 18
 
19 19
         return $this->cache($this->makeCacheTags())
20 20
             ->rememberForever(
21 21
                 $this->makeCacheKey(['*'], null, "-avg_{$column}"),
22
-                function () use ($column) {
22
+                function() use ($column) {
23 23
                     return parent::avg($column);
24 24
                 }
25 25
             );
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function count($columns = ['*'])
29 29
     {
30
-        if (! $this->isCachable) {
30
+        if (!$this->isCachable) {
31 31
             return parent::count($columns);
32 32
         }
33 33
 
34 34
         return $this->cache($this->makeCacheTags())
35 35
             ->rememberForever(
36 36
                 $this->makeCacheKey(['*'], null, "-count"),
37
-                function () use ($columns) {
37
+                function() use ($columns) {
38 38
                     return parent::count($columns);
39 39
                 }
40 40
             );
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function cursor()
44 44
     {
45
-        if (! $this->isCachable) {
45
+        if (!$this->isCachable) {
46 46
             return collect(parent::cursor());
47 47
         }
48 48
 
49 49
         return $this->cache($this->makeCacheTags())
50 50
             ->rememberForever(
51 51
                 $this->makeCacheKey(['*'], null, "-cursor"),
52
-                function () {
52
+                function() {
53 53
                     return collect(parent::cursor());
54 54
                 }
55 55
             );
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function find($id, $columns = ['*'])
70 70
     {
71
-        if (! $this->isCachable) {
71
+        if (!$this->isCachable) {
72 72
             return parent::find($id, $columns);
73 73
         }
74 74
 
75 75
         return $this->cache($this->makeCacheTags())
76 76
             ->rememberForever(
77 77
                 $this->makeCacheKey($columns, $id),
78
-                function () use ($id, $columns) {
78
+                function() use ($id, $columns) {
79 79
                     return parent::find($id, $columns);
80 80
                 }
81 81
             );
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
 
84 84
     public function first($columns = ['*'])
85 85
     {
86
-        if (! $this->isCachable) {
86
+        if (!$this->isCachable) {
87 87
             return parent::first($columns);
88 88
         }
89 89
 
90 90
         return $this->cache($this->makeCacheTags())
91 91
             ->rememberForever(
92 92
                 $this->makeCacheKey($columns, null, '-first'),
93
-                function () use ($columns) {
93
+                function() use ($columns) {
94 94
                     return parent::first($columns);
95 95
                 }
96 96
             );
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function get($columns = ['*'])
100 100
     {
101
-        if (! $this->isCachable) {
101
+        if (!$this->isCachable) {
102 102
             return parent::get($columns);
103 103
         }
104 104
 
105 105
         return $this->cache($this->makeCacheTags())
106 106
             ->rememberForever(
107 107
                 $this->makeCacheKey($columns),
108
-                function () use ($columns) {
108
+                function() use ($columns) {
109 109
                     return parent::get($columns);
110 110
                 }
111 111
             );
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function max($column)
115 115
     {
116
-        if (! $this->isCachable) {
116
+        if (!$this->isCachable) {
117 117
             return parent::max($column);
118 118
         }
119 119
 
120 120
         return $this->cache($this->makeCacheTags())
121 121
             ->rememberForever(
122 122
                 $this->makeCacheKey(['*'], null, "-max_{$column}"),
123
-                function () use ($column) {
123
+                function() use ($column) {
124 124
                     return parent::max($column);
125 125
                 }
126 126
             );
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 
129 129
     public function min($column)
130 130
     {
131
-        if (! $this->isCachable) {
131
+        if (!$this->isCachable) {
132 132
             return parent::min($column);
133 133
         }
134 134
 
135 135
         return $this->cache($this->makeCacheTags())
136 136
             ->rememberForever(
137 137
                 $this->makeCacheKey(['*'], null, "-min_{$column}"),
138
-                function () use ($column) {
138
+                function() use ($column) {
139 139
                     return parent::min($column);
140 140
                 }
141 141
             );
@@ -143,29 +143,29 @@  discard block
 block discarded – undo
143 143
 
144 144
     public function pluck($column, $key = null)
145 145
     {
146
-        if (! $this->isCachable) {
146
+        if (!$this->isCachable) {
147 147
             return parent::pluck($column, $key);
148 148
         }
149 149
 
150
-        $keyDifferentiator = "-pluck_{$column}" . ($key ? "_{$key}" : "");
150
+        $keyDifferentiator = "-pluck_{$column}".($key ? "_{$key}" : "");
151 151
         $cacheKey = $this->makeCacheKey([$column], null, $keyDifferentiator);
152 152
 
153 153
         return $this->cache($this->makeCacheTags())
154
-            ->rememberForever($cacheKey, function () use ($column, $key) {
154
+            ->rememberForever($cacheKey, function() use ($column, $key) {
155 155
                 return parent::pluck($column, $key);
156 156
             });
157 157
     }
158 158
 
159 159
     public function sum($column)
160 160
     {
161
-        if (! $this->isCachable) {
161
+        if (!$this->isCachable) {
162 162
             return parent::sum($column);
163 163
         }
164 164
 
165 165
         return $this->cache($this->makeCacheTags())
166 166
             ->rememberForever(
167 167
                 $this->makeCacheKey(['*'], null, "-sum_{$column}"),
168
-                function () use ($column) {
168
+                function() use ($column) {
169 169
                     return parent::sum($column);
170 170
                 }
171 171
             );
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 
174 174
     public function value($column)
175 175
     {
176
-        if (! $this->isCachable) {
176
+        if (!$this->isCachable) {
177 177
             return parent::value($column);
178 178
         }
179 179
 
180 180
         return $this->cache($this->makeCacheTags())
181 181
             ->rememberForever(
182 182
                 $this->makeCacheKey(['*'], null, "-value_{$column}"),
183
-                function () use ($column) {
183
+                function() use ($column) {
184 184
                     return parent::value($column);
185 185
                 }
186 186
             );
Please login to merge, or discard this patch.
src/Traits/Cachable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     public static function bootCachable()
67 67
     {
68
-        static::saved(function ($instance) {
68
+        static::saved(function($instance) {
69 69
             $instance->flushCache();
70 70
         });
71 71
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $key = $instance->makeCacheKey();
79 79
 
80 80
         return $instance->cache($tags)
81
-            ->rememberForever($key, function () use ($columns) {
81
+            ->rememberForever($key, function() use ($columns) {
82 82
                 return parent::all($columns);
83 83
             });
84 84
     }
Please login to merge, or discard this patch.
src/CacheKey.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
     protected function getLimitClause() : string
45 45
     {
46
-        if (! $this->query->limit) {
46
+        if (!$this->query->limit) {
47 47
             return '';
48 48
         }
49 49
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     protected function getOffsetClause() : string
59 59
     {
60
-        if (! $this->query->offset) {
60
+        if (!$this->query->offset) {
61 61
             return '';
62 62
         }
63 63
 
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
         $orders = collect($this->query->orders);
70 70
 
71 71
         return $orders
72
-            ->reduce(function ($carry, $order) {
72
+            ->reduce(function($carry, $order) {
73 73
                 if (($order['type'] ?? '') === 'Raw') {
74
-                    return $carry . '_orderByRaw_' . str_slug($order['sql']);
74
+                    return $carry.'_orderByRaw_'.str_slug($order['sql']);
75 75
                 }
76 76
 
77
-                return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction'];
77
+                return $carry.'_orderBy_'.$order['column'].'_'.$order['direction'];
78 78
             })
79 79
             ?: '';
80 80
     }
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
             return '';
86 86
         }
87 87
 
88
-        return '_' . implode('_', $columns);
88
+        return '_'.implode('_', $columns);
89 89
     }
90 90
 
91 91
     protected function getTypeClause($where) : string
92 92
     {
93
-        $type =in_array($where['type'], ['In', 'NotIn', 'Null', 'NotNull', 'between'])
93
+        $type = in_array($where['type'], ['In', 'NotIn', 'Null', 'NotNull', 'between'])
94 94
             ? strtolower($where['type'])
95 95
             : strtolower($where['operator']);
96 96
 
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
             ? implode('_', $where['values'])
108 108
             : '';
109 109
 
110
-        if (! $values && $this->query->bindings['where'] ?? false) {
110
+        if (!$values && $this->query->bindings['where'] ?? false) {
111 111
             $values = implode('_', $this->query->bindings['where']);
112 112
         }
113 113
 
114
-        return '_' . $values;
114
+        return '_'.$values;
115 115
     }
116 116
 
117 117
     protected function getWhereClauses(array $wheres = []) : string
118 118
     {
119 119
         return $this->getWheres($wheres)
120
-            ->reduce(function ($carry, $where) {
120
+            ->reduce(function($carry, $where) {
121 121
                 $value = $this->getNestedClauses($where);
122 122
                 $value .= $this->getColumnClauses($where);
123 123
                 $value .= $this->getRawClauses($where);
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
 
131 131
     protected function getNestedClauses(array $where) : string
132 132
     {
133
-        if (! in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) {
133
+        if (!in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) {
134 134
             return '';
135 135
         }
136 136
 
137
-        return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres);
137
+        return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres);
138 138
     }
139 139
 
140 140
     protected function getColumnClauses(array $where) : string
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             return '';
153 153
         }
154 154
 
155
-        return "_{$where['boolean']}_" . str_slug($where['sql']);
155
+        return "_{$where['boolean']}_".str_slug($where['sql']);
156 156
     }
157 157
 
158 158
     protected function getOtherClauses(array $where, string $carry = null) : string
@@ -186,6 +186,6 @@  discard block
 block discarded – undo
186 186
             return '';
187 187
         }
188 188
 
189
-        return '-' . implode('-', $eagerLoads->keys()->toArray());
189
+        return '-'.implode('-', $eagerLoads->keys()->toArray());
190 190
     }
191 191
 }
Please login to merge, or discard this patch.
src/Console/Commands/Flush.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         $option = $this->option('model');
13 13
 
14
-        if (! $option) {
14
+        if (!$option) {
15 15
             $this->error("You must specify a model to flush a model's cache:");
16 16
             $this->line("modelCache:flush --model=App\\Model");
17 17
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
         $model = new $option;
22 22
 
23
-        if (! method_exists($model, 'flushCache')) {
23
+        if (!method_exists($model, 'flushCache')) {
24 24
             $this->error("'{$option}' is not an instance of CachedModel.");
25 25
             $this->line("Only CachedModel instances can be flushed.");
26 26
 
Please login to merge, or discard this patch.