Passed
Push — master ( da7973...b49e12 )
by Mike
03:53
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/Console/Commands/Flush.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     {
13 13
         $option = $this->option('model');
14 14
 
15
-        if (! $option) {
15
+        if (!$option) {
16 16
             $this->error("You must specify a model to flush a model's cache:");
17 17
             $this->line("modelCache:flush --model=App\\Model");
18 18
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
         $model = new $option;
23 23
 
24
-        if (! $model instanceof CachedModel) {
24
+        if (!$model instanceof CachedModel) {
25 25
             $this->error("'{$option}' is not an instance of CachedModel.");
26 26
             $this->line("Only CachedModel instances can be flushed.");
27 27
 
Please login to merge, or discard this patch.
src/CachedModel.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
         $class = get_called_class();
34 34
         $instance = new $class;
35 35
 
36
-        static::created(function () use ($instance) {
36
+        static::created(function() use ($instance) {
37 37
             $instance->flushCache();
38 38
         });
39 39
 
40
-        static::deleted(function () use ($instance) {
40
+        static::deleted(function() use ($instance) {
41 41
             $instance->flushCache();
42 42
         });
43 43
 
44
-        static::saved(function () use ($instance) {
44
+        static::saved(function() use ($instance) {
45 45
             $instance->flushCache();
46 46
         });
47 47
 
48
-        static::updated(function () use ($instance) {
48
+        static::updated(function() use ($instance) {
49 49
             $instance->flushCache();
50 50
         });
51 51
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         $key = $instance->makeCacheKey();
59 59
 
60 60
         return $instance->cache($tags)
61
-            ->rememberForever($key, function () use ($columns) {
61
+            ->rememberForever($key, function() use ($columns) {
62 62
                 return parent::all($columns);
63 63
             });
64 64
     }
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/CacheKey.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
     protected function getLimitClause() : string
46 46
     {
47
-        if (! $this->query->limit) {
47
+        if (!$this->query->limit) {
48 48
             return '';
49 49
         }
50 50
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
     protected function getOffsetClause() : string
60 60
     {
61
-        if (! $this->query->offset) {
61
+        if (!$this->query->offset) {
62 62
             return '';
63 63
         }
64 64
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
         $orders = collect($this->query->orders);
71 71
 
72 72
         return $orders
73
-            ->reduce(function ($carry, $order) {
73
+            ->reduce(function($carry, $order) {
74 74
                 if (($order['type'] ?? '') === 'Raw') {
75
-                    return $carry . '_orderByRaw_' . str_slug($order['sql']);
75
+                    return $carry.'_orderByRaw_'.str_slug($order['sql']);
76 76
                 }
77 77
 
78
-                return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction'];
78
+                return $carry.'_orderBy_'.$order['column'].'_'.$order['direction'];
79 79
             })
80 80
             ?: '';
81 81
     }
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
             return '';
87 87
         }
88 88
 
89
-        return '_' . implode('_', $columns);
89
+        return '_'.implode('_', $columns);
90 90
     }
91 91
 
92 92
     protected function getTypeClause($where) : string
93 93
     {
94
-        $type =in_array($where['type'], ['In', 'Null', 'NotNull'])
94
+        $type = in_array($where['type'], ['In', 'Null', 'NotNull'])
95 95
             ? strtolower($where['type'])
96 96
             : strtolower($where['operator']);
97 97
 
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
     protected function getValuesClause(array $where = null) : string
102 102
     {
103 103
         return is_array(array_get($where, 'values'))
104
-            ? '_' . implode('_', $where['values'])
104
+            ? '_'.implode('_', $where['values'])
105 105
             : '';
106 106
     }
107 107
 
108 108
     protected function getWhereClauses(array $wheres = []) : string
109 109
     {
110 110
         return $this->getWheres($wheres)
111
-            ->reduce(function ($carry, $where) {
111
+            ->reduce(function($carry, $where) {
112 112
                 $value = $this->getNestedClauses($where);
113 113
                 $value .= $this->getColumnClauses($where);
114 114
                 $value .= $this->getRawClauses($where);
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 
122 122
     protected function getNestedClauses(array $where) : string
123 123
     {
124
-        if (! in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) {
124
+        if (!in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) {
125 125
             return '';
126 126
         }
127 127
 
128
-        return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres);
128
+        return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres);
129 129
     }
130 130
 
131 131
     protected function getColumnClauses(array $where) : string
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             return '';
144 144
         }
145 145
 
146
-        return "_{$where['boolean']}_" . str_slug($where['sql']);
146
+        return "_{$where['boolean']}_".str_slug($where['sql']);
147 147
     }
148 148
 
149 149
     protected function getOtherClauses(array $where, string $carry = null) : string
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         }
154 154
 
155 155
         $value = $this->getTypeClause($where);
156
-        $value .= "_" . array_get($where, 'value');
156
+        $value .= "_".array_get($where, 'value');
157 157
         $value .= $this->getValuesClause($where);
158 158
 
159 159
         return "{$carry}-{$where['column']}_{$value}";
@@ -178,6 +178,6 @@  discard block
 block discarded – undo
178 178
             return '';
179 179
         }
180 180
 
181
-        return '-' . implode('-', $eagerLoads->keys()->toArray());
181
+        return '-'.implode('-', $eagerLoads->keys()->toArray());
182 182
     }
183 183
 }
Please login to merge, or discard this patch.