Completed
Pull Request — master (#408)
by
unknown
35s
created
tests/Integration/CachedBuilder/MorphOneTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
         (new Book)
14 14
             ->get()
15
-            ->each(function ($book) {
15
+            ->each(function($book) {
16 16
                 $book->image()->create([
17 17
                     "path" => app(Faker::class)->imageUrl(),
18 18
                 ]);
Please login to merge, or discard this patch.
tests/Integration/CachedBuilder/WhereTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
11 11
     public function testWithQuery()
12 12
     {
13 13
         $books = (new Book)
14
-            ->where(function ($query) {
14
+            ->where(function($query) {
15 15
                 $query->where("id", ">", "1")
16 16
                     ->where("id", "<", "5");
17 17
             })
18 18
             ->get();
19 19
         $uncachedBooks = (new UncachedBook)
20
-            ->where(function ($query) {
20
+            ->where(function($query) {
21 21
                 $query->where("id", ">", "1")
22 22
                     ->where("id", "<", "5");
23 23
             })
Please login to merge, or discard this patch.
tests/Integration/CachedBuilder/WithCountTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
             ->first();
16 16
         factory(Book::class, 1)
17 17
             ->make()
18
-            ->each(function ($book) use ($author1) {
18
+            ->each(function($book) use ($author1) {
19 19
                 $publisher = (new Publisher)->first();
20 20
                 $book->author()->associate($author1);
21 21
                 $book->publisher()->associate($publisher);
Please login to merge, or discard this patch.
tests/Integration/CachedBuilder/WhereHasMorphTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,13 +54,13 @@
 block discarded – undo
54 54
     public function testWithMultipleMorphModelsWithClosure()
55 55
     {
56 56
         $comments = (new Comment)
57
-            ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function (Builder $query) {
58
-                return $query->where('subject', 'like',  '%uncached post');
57
+            ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function(Builder $query) {
58
+                return $query->where('subject', 'like', '%uncached post');
59 59
             })
60 60
             ->get();
61 61
         $uncachedComments = (new UncachedComment())
62
-            ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function (Builder $query) {
63
-                return $query->where('subject', 'like',  '%uncached post');
62
+            ->whereHasMorph('commentable', [Post::class, UncachedPost::class], function(Builder $query) {
63
+                return $query->where('subject', 'like', '%uncached post');
64 64
             })
65 65
             ->get();
66 66
 
Please login to merge, or discard this patch.
tests/Integration/CachedModelTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $books = (new Book)
112 112
             ->with('author')
113
-            ->whereHas('author', function ($query) {
113
+            ->whereHas('author', function($query) {
114 114
                 $query->whereId('1');
115 115
             })
116 116
             ->get();
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $books1 = (new Book)
136 136
             ->with('author')
137
-            ->whereHas('author', function ($query) {
137
+            ->whereHas('author', function($query) {
138 138
                 $query->whereId(1);
139 139
             })
140 140
             ->get()
141 141
             ->keyBy('id');
142 142
         $books2 = (new Book)
143 143
             ->with('author')
144
-            ->whereHas('author', function ($query) {
144
+            ->whereHas('author', function($query) {
145 145
                 $query->whereId(2);
146 146
             })
147 147
             ->get()
Please login to merge, or discard this patch.
tests/Integration/DisabledCachedBuilderTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         $authors = (new Author)->with('books', 'profile')
52 52
             ->disableCache()
53
-            ->chunk($chunkSize, function ($chunk) use (&$cachedChunks, $chunkSize) {
53
+            ->chunk($chunkSize, function($chunk) use (&$cachedChunks, $chunkSize) {
54 54
                 $offset = '';
55 55
 
56 56
                 if ($cachedChunks['authors']->count()) {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             });
66 66
 
67 67
         $liveResults = (new UncachedAuthor)->with('books', 'profile')
68
-            ->chunk($chunkSize, function ($chunk) use (&$uncachedChunks) {
68
+            ->chunk($chunkSize, function($chunk) use (&$uncachedChunks) {
69 69
                 $uncachedChunks->push($chunk);
70 70
             });
71 71
 
Please login to merge, or discard this patch.
tests/Integration/CachedBuilder/SubQueryAddSelectTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         /** @var Collection $publishers */
20 20
         $publishers = factory(UncachedPublisher::class, 5)->create();
21 21
 
22
-        $publishers->each(function (UncachedPublisher $publisher) {
22
+        $publishers->each(function(UncachedPublisher $publisher) {
23 23
             factory(UncachedBook::class, 2)->create(['publisher_id' => $publisher->id]);
24 24
         });
25 25
 
Please login to merge, or discard this patch.
src/CacheKey.php 1 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.