Completed
Pull Request — master (#408)
by
unknown
42s
created
tests/Feature/PaginationTest.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -88,15 +88,15 @@
 block discarded – undo
88 88
     }
89 89
 
90 90
     public function testPaginationUrlIsCorrect() {
91
-    	$this->baseUrl = 'https://test.local';
91
+        $this->baseUrl = 'https://test.local';
92 92
 
93
-    	$this->visit("pagination-test2?custom-page=2")
94
-		    ->see('https://test.local/pagination-test2?custom-page=1');
93
+        $this->visit("pagination-test2?custom-page=2")
94
+            ->see('https://test.local/pagination-test2?custom-page=1');
95 95
 
96
-    	$this->baseUrl = 'https://changed.local';
96
+        $this->baseUrl = 'https://changed.local';
97 97
 
98
-    	$this->visit("pagination-test2?custom-page=2")
99
-	        ->see('https://changed.local/pagination-test2?custom-page=1');
98
+        $this->visit("pagination-test2?custom-page=2")
99
+            ->see('https://changed.local/pagination-test2?custom-page=1');
100 100
 
101 101
     }
102 102
 }
Please login to merge, or discard this patch.
src/CacheKey.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -367,6 +367,6 @@
 block discarded – undo
367 367
 
368 368
     protected function getPathSlug() : string
369 369
     {
370
-    	return ':' . strtolower(URL::to('/'));
370
+        return ':' . strtolower(URL::to('/'));
371 371
     }
372 372
 }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
     protected function getLimitClause() : string
62 62
     {
63
-        if (! property_exists($this->query, "limit")
64
-            || ! $this->query->limit
63
+        if (!property_exists($this->query, "limit")
64
+            || !$this->query->limit
65 65
         ) {
66 66
             return "";
67 67
         }
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 
83 83
     protected function getOffsetClause() : string
84 84
     {
85
-        if (! property_exists($this->query, "offset")
86
-            || ! $this->query->offset
85
+        if (!property_exists($this->query, "offset")
86
+            || !$this->query->offset
87 87
         ) {
88 88
             return "";
89 89
         }
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 
94 94
     protected function getOrderByClauses() : string
95 95
     {
96
-        if (! property_exists($this->query, "orders")
97
-            || ! $this->query->orders
96
+        if (!property_exists($this->query, "orders")
97
+            || !$this->query->orders
98 98
         ) {
99 99
             return "";
100 100
         }
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
         $orders = collect($this->query->orders);
103 103
 
104 104
         return $orders
105
-            ->reduce(function ($carry, $order) {
105
+            ->reduce(function($carry, $order) {
106 106
                 if (($order["type"] ?? "") === "Raw") {
107
-                    return $carry . "_orderByRaw_" . (new Str)->slug($order["sql"]);
107
+                    return $carry."_orderByRaw_".(new Str)->slug($order["sql"]);
108 108
                 }
109 109
 
110
-                return $carry . "_orderBy_" . $order["column"] . "_" . $order["direction"];
110
+                return $carry."_orderBy_".$order["column"]."_".$order["direction"];
111 111
             })
112 112
             ?: "";
113 113
     }
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
     {
117 117
         if (($columns === ["*"]
118 118
                 || $columns === [])
119
-            && (! property_exists($this->query, "columns")
120
-                || ! $this->query->columns)
119
+            && (!property_exists($this->query, "columns")
120
+                || !$this->query->columns)
121 121
         ) {
122 122
             return "";
123 123
         }
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
         if (property_exists($this->query, "columns")
126 126
             && $this->query->columns
127 127
         ) {
128
-            return "_" . implode("_", $this->query->columns);
128
+            return "_".implode("_", $this->query->columns);
129 129
         }
130 130
 
131
-        return "_" . implode("_", $columns);
131
+        return "_".implode("_", $columns);
132 132
     }
133 133
 
134 134
     protected function getTypeClause($where) : string
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     protected function getValuesClause(array $where = []) : string
144 144
     {
145
-        if (! $where
145
+        if (!$where
146 146
             || in_array($where["type"], ["NotNull", "Null"])
147 147
         ) {
148 148
             return "";
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $values = $this->getValuesFromWhere($where);
152 152
         $values = $this->getValuesFromBindings($where, $values);
153 153
 
154
-        return "_" . $values;
154
+        return "_".$values;
155 155
     }
156 156
 
157 157
     protected function getValuesFromWhere(array $where) : string
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             $this->currentBinding++;
182 182
 
183 183
             if ($where["type"] === "between") {
184
-                $values .= "_" . $this->query->bindings["where"][$this->currentBinding];
184
+                $values .= "_".$this->query->bindings["where"][$this->currentBinding];
185 185
                 $this->currentBinding++;
186 186
             }
187 187
         }
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 
198 198
     protected function getWhereClauses(array $wheres = []) : string
199 199
     {
200
-        return "" . $this->getWheres($wheres)
201
-            ->reduce(function ($carry, $where) {
200
+        return "".$this->getWheres($wheres)
201
+            ->reduce(function($carry, $where) {
202 202
                 $value = $carry;
203 203
                 $value .= $this->getNestedClauses($where);
204 204
                 $value .= $this->getColumnClauses($where);
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 
213 213
     protected function getNestedClauses(array $where) : string
214 214
     {
215
-        if (! in_array($where["type"], ["Exists", "Nested", "NotExists"])) {
215
+        if (!in_array($where["type"], ["Exists", "Nested", "NotExists"])) {
216 216
             return "";
217 217
         }
218 218
 
219
-        return "-" . strtolower($where["type"]) . $this->getWhereClauses($where["query"]->wheres);
219
+        return "-".strtolower($where["type"]).$this->getWhereClauses($where["query"]->wheres);
220 220
     }
221 221
 
222 222
     protected function getColumnClauses(array $where) : string
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
     protected function getInAndNotInClauses(array $where) : string
232 232
     {
233
-        if (! in_array($where["type"], ["In", "NotIn", "InRaw"])) {
233
+        if (!in_array($where["type"], ["In", "NotIn", "InRaw"])) {
234 234
             return "";
235 235
         }
236 236
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $this->currentBinding += count($where["values"]);
243 243
         }
244 244
 
245
-        if (! is_numeric($subquery) && ! is_numeric(str_replace("_", "", $subquery))) {
245
+        if (!is_numeric($subquery) && !is_numeric(str_replace("_", "", $subquery))) {
246 246
             try {
247 247
                 $subquery = Uuid::fromBytes($subquery);
248 248
                 $values = $this->recursiveImplode([$subquery], "_");
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 continue;
281 281
             }
282 282
 
283
-            $result .= $glue . $value;
283
+            $result .= $glue.$value;
284 284
         }
285 285
 
286 286
         return $result;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
     protected function getRawClauses(array $where) : string
290 290
     {
291
-        if (! in_array($where["type"], ["raw"])) {
291
+        if (!in_array($where["type"], ["raw"])) {
292 292
             return "";
293 293
         }
294 294
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $clause = "_{$where["boolean"]}";
297 297
 
298 298
         while (count($queryParts) > 1) {
299
-            $clause .= "_" . array_shift($queryParts);
299
+            $clause .= "_".array_shift($queryParts);
300 300
             $clause .= $this->query->bindings["where"][$this->currentBinding];
301 301
             $this->currentBinding++;
302 302
         }
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
         $lastPart = array_shift($queryParts);
305 305
 
306 306
         if ($lastPart) {
307
-            $clause .= "_" . $lastPart;
307
+            $clause .= "_".$lastPart;
308 308
         }
309 309
 
310
-        return "-" . str_replace(" ", "_", $clause);
310
+        return "-".str_replace(" ", "_", $clause);
311 311
     }
312 312
 
313 313
     protected function getOtherClauses(array $where) : string
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
             return "";
344 344
         }
345 345
 
346
-        return $eagerLoads->keys()->reduce(function ($carry, $related) {
347
-            if (! method_exists($this->model, $related)) {
346
+        return $eagerLoads->keys()->reduce(function($carry, $related) {
347
+            if (!method_exists($this->model, $related)) {
348 348
                 return "{$carry}-{$related}";
349 349
             }
350 350
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
     protected function getBindingsSlug() : string
360 360
     {
361
-        if (! method_exists($this->model, 'query')) {
361
+        if (!method_exists($this->model, 'query')) {
362 362
             return '';
363 363
         }
364 364
 
@@ -367,6 +367,6 @@  discard block
 block discarded – undo
367 367
 
368 368
     protected function getPathSlug() : string
369 369
     {
370
-    	return ':' . strtolower(URL::to('/'));
370
+    	return ':'.strtolower(URL::to('/'));
371 371
     }
372 372
 }
Please login to merge, or discard this patch.
tests/Integration/CachedBuilderTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
                 "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"
49 49
             ])
50 50
             ->get(sha1(
51
-                "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" .
51
+                "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_".
52 52
                 "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks"
53 53
             ));
54 54
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"
67 67
             ])
68 68
             ->get(sha1(
69
-                "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" .
69
+                "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_".
70 70
                 "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks"
71 71
             ));
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
                 "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbook"
84 84
             ])
85 85
             ->get(sha1(
86
-                "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" .
86
+                "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_".
87 87
                 "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks"
88 88
             ));
89 89
 
@@ -186,11 +186,11 @@  discard block
 block discarded – undo
186 186
         $chunkedKeys = [];
187 187
         $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"];
188 188
         (new Author)
189
-            ->chunk(3, function ($authors) use (&$chunkedAuthors, &$chunkedKeys) {
189
+            ->chunk(3, function($authors) use (&$chunkedAuthors, &$chunkedKeys) {
190 190
                 $offset = "";
191 191
 
192 192
                 if (count($chunkedKeys)) {
193
-                    $offset = "-offset_" . (count($chunkedKeys) * 3);
193
+                    $offset = "-offset_".(count($chunkedKeys) * 3);
194 194
                 }
195 195
 
196 196
                 $key = "genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null_orderBy_authors.id_asc{$offset}-limit_3:http://localhost";
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
             ->tags($tags1)
664 664
             ->rememberForever(
665 665
                 $key1,
666
-                function () use ($key2, $authors) {
666
+                function() use ($key2, $authors) {
667 667
                     return [
668 668
                         'key' => $key2,
669 669
                         'value' => $authors,
Please login to merge, or discard this patch.
tests/Integration/CachedBuilder/DateTimeTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
     public function testWhereClauseWorksWithDateTimeObject()
37 37
     {
38
-        $dateTime = (new DateTime('@' . time()))
38
+        $dateTime = (new DateTime('@'.time()))
39 39
             ->sub(new DateInterval("P10Y"));
40 40
         $dateTimeString = $dateTime->format("Y-m-d-H-i-s");
41 41
         $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:books:genealabslaravelmodelcachingtestsfixturesbook-publish_at_>_{$dateTimeString}:http://localhost");
Please login to merge, or discard this patch.
tests/Integration/CachedBuilder/WhereRawTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             ->whereRaw("name != 'test3'")
35 35
             ->whereRaw('name = ? AND name != ?', [$authorName, "test2"])
36 36
             ->get();
37
-        $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_!=_test-_and_name_!=_'test3'-_and_name_=_" . str_replace(" ", "_", $authorName) . "__AND_name_!=_test2-authors.deleted_at_null:http://localhost");
37
+        $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-name_!=_test-_and_name_!=_'test3'-_and_name_=_".str_replace(" ", "_", $authorName)."__AND_name_!=_test2-authors.deleted_at_null:http://localhost");
38 38
         $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"];
39 39
 
40 40
         $cachedResults = collect([$this->cache()->tags($tags)->get($key)['value']]);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         ];
71 71
 
72 72
         $authors = (new Author)
73
-            ->where(function ($query) {
73
+            ->where(function($query) {
74 74
                 $query->orWhereRaw("id BETWEEN 1 AND 3")
75 75
                     ->orWhereRaw("id BETWEEN 5 AND 6");
76 76
             })
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
     public function testNestedWhereRawWithBindings()
83 83
     {
84 84
         $books = (new Book)
85
-            ->where(function ($query) {
86
-                $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%',]);
85
+            ->where(function($query) {
86
+                $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%', ]);
87 87
             })->get();
88 88
 
89 89
         $uncachedBooks = (new UncachedBook)
90
-            ->where(function ($query) {
91
-                $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%',]);
90
+            ->where(function($query) {
91
+                $query->whereRaw("title like ? or description like ? or published_at like ? or price like ?", ['%larravel%', '%larravel%', '%larravel%', '%larravel%', ]);
92 92
             })->get();
93 93
 
94 94
         $this->assertEquals($books->pluck("id"), $uncachedBooks->pluck("id"));
Please login to merge, or discard this patch.
tests/Integration/HelperTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
         $key = sha1("genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor-authors.deleted_at_null:http://localhost");
12 12
         $tags = ["genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesauthor"];
13 13
 
14
-        $authors = app("model-cache")->runDisabled(function () {
14
+        $authors = app("model-cache")->runDisabled(function() {
15 15
             return (new Author)
16 16
                 ->get();
17 17
         });
Please login to merge, or discard this patch.