Completed
Push — master ( 63f180...f26f13 )
by Mike
19:47 queued 15:02
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/CacheKey.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     protected function getLimitClause() : string
40 40
     {
41
-        if (! $this->query->limit) {
41
+        if (!$this->query->limit) {
42 42
             return '';
43 43
         }
44 44
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
     protected function getOffsetClause() : string
54 54
     {
55
-        if (! $this->query->offset) {
55
+        if (!$this->query->offset) {
56 56
             return '';
57 57
         }
58 58
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
         $orders = collect($this->query->orders);
65 65
 
66 66
         return $orders
67
-            ->reduce(function ($carry, $order) {
67
+            ->reduce(function($carry, $order) {
68 68
                 if (($order['type'] ?? '') === 'Raw') {
69
-                    return $carry . '_orderByRaw_' . str_slug($order['sql']);
69
+                    return $carry.'_orderByRaw_'.str_slug($order['sql']);
70 70
                 }
71 71
 
72
-                return $carry . '_orderBy_' . $order['column'] . '_' . $order['direction'];
72
+                return $carry.'_orderBy_'.$order['column'].'_'.$order['direction'];
73 73
             })
74 74
             ?: '';
75 75
     }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             return '';
81 81
         }
82 82
 
83
-        return '_' . implode('_', $columns);
83
+        return '_'.implode('_', $columns);
84 84
     }
85 85
 
86 86
     protected function getTypeClause($where) : string
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
     protected function getValuesClause(array $where = null) : string
94 94
     {
95 95
         return is_array(array_get($where, 'values'))
96
-            ? '_' . implode('_', $where['values'])
96
+            ? '_'.implode('_', $where['values'])
97 97
             : '';
98 98
     }
99 99
 
100 100
     protected function getWhereClauses(array $wheres = []) : string
101 101
     {
102 102
         return $this->getWheres($wheres)
103
-            ->reduce(function ($carry, $where) {
103
+            ->reduce(function($carry, $where) {
104 104
                 $value = $this->getNestedClauses($where);
105 105
                 $value .= $this->getColumnClauses($where);
106 106
                 $value .= $this->getRawClauses($where);
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 
114 114
     protected function getNestedClauses(array $where) : string
115 115
     {
116
-        if (! in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) {
116
+        if (!in_array($where['type'], ['Exists', 'Nested', 'NotExists'])) {
117 117
             return '';
118 118
         }
119 119
 
120
-        return '_' . strtolower($where['type']) . $this->getWhereClauses($where['query']->wheres);
120
+        return '_'.strtolower($where['type']).$this->getWhereClauses($where['query']->wheres);
121 121
     }
122 122
 
123 123
     protected function getColumnClauses(array $where) : string
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             return '';
136 136
         }
137 137
 
138
-        return "_{$where['boolean']}_" . str_slug($where['sql']);
138
+        return "_{$where['boolean']}_".str_slug($where['sql']);
139 139
     }
140 140
 
141 141
     protected function getOtherClauses(array $where, string $carry = null) : string
@@ -170,6 +170,6 @@  discard block
 block discarded – undo
170 170
             return '';
171 171
         }
172 172
 
173
-        return '-' . implode('-', $eagerLoads->keys()->toArray());
173
+        return '-'.implode('-', $eagerLoads->keys()->toArray());
174 174
     }
175 175
 }
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.