Passed
Pull Request — master (#8)
by
unknown
05:39
created
Contentful/Commands/Generators/Definitions/BooleanDefinition.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
      */
10 10
     public function modelGetter()
11 11
     {
12
-        $stubPath = __DIR__ . '/stubs/boolean.stub';
12
+        $stubPath = __DIR__.'/stubs/boolean.stub';
13 13
 
14 14
         return self::getStub($stubPath, [
15 15
             'field' => $this->id(),
@@ -22,6 +22,6 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function modelProperty()
24 24
     {
25
-        return ' * @property bool $' . $this->snakeId();
25
+        return ' * @property bool $'.$this->snakeId();
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Commands/Generators/AbstractGenerator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function tableName($id)
40 40
     {
41
-        return DB::getTablePrefix() . Str::plural(Str::snake($id));
41
+        return DB::getTablePrefix().Str::plural(Str::snake($id));
42 42
     }
43 43
 
44 44
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $content = file_get_contents($stubPath);
57 57
         foreach ($replacements as $key => $value) {
58
-            $content = str_replace('{{' . Str::upper($key) . '}}', $value, $content);
58
+            $content = str_replace('{{'.Str::upper($key).'}}', $value, $content);
59 59
         }
60 60
 
61 61
         file_put_contents($destPath, $content);
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
             ]],
99 99
         ];
100 100
 
101
-        $assetContentType['fields'] = array_map(function ($field) {
102
-            if (! isset($field['required'])) {
101
+        $assetContentType['fields'] = array_map(function($field) {
102
+            if (!isset($field['required'])) {
103 103
                 $field['required'] = true;
104 104
             }
105 105
             $field['disabled'] = false;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     protected function fieldDefinition($table, $field): ?DefinitionInterface
122 122
     {
123
-        $className = '\Distilleries\Contentful\Commands\Generators\Definitions\\' . $field['type'] . 'Definition';
123
+        $className = '\Distilleries\Contentful\Commands\Generators\Definitions\\'.$field['type'].'Definition';
124 124
 
125 125
         if (class_exists($className)) {
126 126
             return new $className($table, $field);
@@ -137,6 +137,6 @@  discard block
 block discarded – undo
137 137
      */
138 138
     protected function isFieldEnabled($field): bool
139 139
     {
140
-        return ! $field['disabled'] && ! $field['omitted'];
140
+        return !$field['disabled'] && !$field['omitted'];
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Commands/Generators/Models.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $contentTypes = $this->api->contentTypes();
29 29
 
30
-        if (! empty($contentTypes['items'])) {
30
+        if (!empty($contentTypes['items'])) {
31 31
             array_unshift($contentTypes['items'], $this->assetContentType());
32 32
 
33 33
             foreach ($contentTypes['items'] as $contentType) {
34 34
                 if ($contentType['sys']['id'] !== 'asset') {
35
-                    $this->info('Content-Type: ' . Str::upper($contentType['name']));
35
+                    $this->info('Content-Type: '.Str::upper($contentType['name']));
36 36
                     $file = $this->createMapper($contentType);
37
-                    $this->line('Mapper "' . $file . '" created');
37
+                    $this->line('Mapper "'.$file.'" created');
38 38
                     $file = $this->createModel($contentType);
39
-                    $this->line('Model "' . $file . '" created');
39
+                    $this->line('Model "'.$file.'" created');
40 40
                 }
41 41
             }
42 42
         }
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $table = $this->tableName($contentType['sys']['id']);
55 55
         $model = Str::studly(Str::singular($table));
56 56
 
57
-        $stubPath = __DIR__ . '/stubs/model.stub';
58
-        $destPath = rtrim(config('contentful.generator.model'), '/') . '/' . $model . '.php';
57
+        $stubPath = __DIR__.'/stubs/model.stub';
58
+        $destPath = rtrim(config('contentful.generator.model'), '/').'/'.$model.'.php';
59 59
 
60 60
         return static::writeStub($stubPath, $destPath, [
61 61
             'model' => $model,
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
         $table = $this->tableName($contentType['sys']['id']);
77 77
         $model = Str::studly(Str::singular($table));
78 78
 
79
-        $stubPath = __DIR__ . '/stubs/mapper.stub';
80
-        $destPath = rtrim(config('contentful.generator.mapper'), '/') . '/' . $model . 'Mapper.php';
79
+        $stubPath = __DIR__.'/stubs/mapper.stub';
80
+        $destPath = rtrim(config('contentful.generator.mapper'), '/').'/'.$model.'Mapper.php';
81 81
 
82 82
         return static::writeStub($stubPath, $destPath, [
83 83
             'model' => $model
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
             }
103 103
         }
104 104
 
105
-        $getters = rtrim(implode("\n", array_map(function ($getter) {
105
+        $getters = rtrim(implode("\n", array_map(function($getter) {
106 106
             return $getter;
107 107
         }, $getters)));
108 108
 
109
-        return ! empty($getters) ? "\n" . $getters : "\n\t\t//";
109
+        return !empty($getters) ? "\n".$getters : "\n\t\t//";
110 110
     }
111 111
 
112 112
     /**
@@ -127,6 +127,6 @@  discard block
 block discarded – undo
127 127
             }
128 128
         }
129 129
 
130
-        return ! empty($properties) ? "\n" . implode("\n", $properties) : '';
130
+        return !empty($properties) ? "\n".implode("\n", $properties) : '';
131 131
     }
132 132
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Repositories/AssetsRepository.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $locales = [];
62 62
 
63
-        if (isset($asset['fields']) && ! empty($asset['fields'])) {
63
+        if (isset($asset['fields']) && !empty($asset['fields'])) {
64 64
             $firstField = Arr::first($asset['fields']);
65 65
             $locales = array_keys($firstField);
66 66
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $country = Locale::getCountry($locale);
81 81
         $iso = Locale::getLocale($locale);
82 82
 
83
-        if (! Locale::canBeSave($country, $iso)) {
83
+        if (!Locale::canBeSave($country, $iso)) {
84 84
             return null;
85 85
         }
86 86
 
@@ -165,10 +165,8 @@  discard block
 block discarded – undo
165 165
      */
166 166
     protected function getFieldValue(array $fields, string $field, string $locale, string $fallbackLocale, $default, string $secondFallback = null)
167 167
     {
168
-        return ! empty($fields[$field][$locale]) ?
169
-            $fields[$field][$locale] :
170
-            (! empty($fields[$field][$fallbackLocale]) ? $fields[$field][$fallbackLocale] :
171
-                (! empty($secondFallback) && ! empty($fields[$field][$secondFallback]) ? $fields[$field][$secondFallback] : $default)
168
+        return !empty($fields[$field][$locale]) ?
169
+            $fields[$field][$locale] : (!empty($fields[$field][$fallbackLocale]) ? $fields[$field][$fallbackLocale] : (!empty($secondFallback) && !empty($fields[$field][$secondFallback]) ? $fields[$field][$secondFallback] : $default)
172 170
             );
173 171
     }
174 172
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Repositories/EntriesRepository.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $modelPath = config('contentful.generator.model');
27 27
 
28
-        foreach (glob($modelPath . '/*.php') as $file) {
28
+        foreach (glob($modelPath.'/*.php') as $file) {
29 29
             $modelInstance = NamespaceResolver::model(str_replace(
30 30
                 [$modelPath, '.php', '/'],
31 31
                 ['', '', '\\'],
32 32
                 $file
33 33
             ));
34 34
 
35
-            if (! empty($modelInstance) && $modelInstance instanceof ContentfulModel) {
35
+            if (!empty($modelInstance) && $modelInstance instanceof ContentfulModel) {
36 36
                 $modelInstance->query()->truncate();
37 37
             }
38 38
         }
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         foreach ($localeEntries as $localeEntry) {
59 59
             $model = $this->upsertLocale($entry, $localeEntry);
60 60
 
61
-            if (! empty($model)) {
61
+            if (!empty($model)) {
62 62
                 if (isset($localeEntry['relationships'])) {
63
-                    $this->handleRelationships($localeEntry['locale'],$localeEntry['country'], $localeEntry['contentful_id'], $this->entryContentType($entry), $localeEntry['relationships']);
63
+                    $this->handleRelationships($localeEntry['locale'], $localeEntry['country'], $localeEntry['contentful_id'], $this->entryContentType($entry), $localeEntry['relationships']);
64 64
                     unset($localeEntry['relationships']);
65 65
                 }
66 66
             } else {
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
      */
111 111
     private function entryMapper(array $entry): ContentfulMapper
112 112
     {
113
-        $class = Str::studly($this->entryContentType($entry)) . 'Mapper';
113
+        $class = Str::studly($this->entryContentType($entry)).'Mapper';
114 114
         $mapperClass = NamespaceResolver::mapper($class);
115 115
 
116
-        if (empty($mapperClass) && ! ($mapperClass instanceof ContentfulMapper)) {
117
-            throw new Exception('Unknown mapper: ' . $class);
116
+        if (empty($mapperClass) && !($mapperClass instanceof ContentfulMapper)) {
117
+            throw new Exception('Unknown mapper: '.$class);
118 118
         }
119 119
 
120 120
         return new $mapperClass;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $modelClass = NamespaceResolver::modelClass($model);
134 134
 
135 135
         if (empty($modelClass)) {
136
-            throw new Exception('Unknown model: ' . $model);
136
+            throw new Exception('Unknown model: '.$model);
137 137
         }
138 138
 
139 139
         return new $modelClass;
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 
165 165
         $order = 1;
166 166
         foreach ($relationships as $relationship) {
167
-            if (! isset($relationship['id']) || ! isset($relationship['type'])) {
168
-                throw new Exception('Relationships malformed! (' . print_r($relationship, true) . ')');
167
+            if (!isset($relationship['id']) || !isset($relationship['type'])) {
168
+                throw new Exception('Relationships malformed! ('.print_r($relationship, true).')');
169 169
             }
170 170
 
171 171
             DB::table('entry_relationships')->insert([
@@ -212,18 +212,18 @@  discard block
 block discarded – undo
212 212
     private function upsertLocale(array $entry, array $data): ?ContentfulModel
213 213
     {
214 214
         $model = $this->entryModel($entry);
215
-        if ((method_exists($model, 'bootNotNullSlug') && empty($data['slug'])) || ! Locale::canBeSave($data['country'], $data['locale'])) {
215
+        if ((method_exists($model, 'bootNotNullSlug') && empty($data['slug'])) || !Locale::canBeSave($data['country'], $data['locale'])) {
216 216
             // Remove instance if slug is empty
217 217
             $instance = $this->instanceQueryBuilder($model, $data)->first();
218
-            if (! empty($instance)) {
218
+            if (!empty($instance)) {
219 219
                 $instance->delete();
220 220
             }
221 221
 
222 222
             return null;
223 223
         }
224 224
 
225
-        if (! isset($data['payload'])) {
226
-            throw new Exception('Mapper for model ' . class_basename($model) . ' must set a "payload" key');
225
+        if (!isset($data['payload'])) {
226
+            throw new Exception('Mapper for model '.class_basename($model).' must set a "payload" key');
227 227
         }
228 228
 
229 229
         $instance = $this->instanceQueryBuilder($model, $data)->first();
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Base/ContentfulMapper.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
             $data['country'] = Locale::getCountry($locale->code);
52 52
             $data['locale'] = Locale::getLocale($locale->code);
53 53
 
54
-            if (! isset($data['payload'])) {
54
+            if (!isset($data['payload'])) {
55 55
                 $data['payload'] = $this->mapPayload($entry, $locale->code);
56 56
             }
57
-            if (! isset($data['relationships'])) {
57
+            if (!isset($data['relationships'])) {
58 58
                 $data['relationships'] = $this->mapRelationships($data['payload']);
59 59
             }
60 60
             if (isset($data['slug']) && Str::contains($data['slug'], 'untitled-')) {
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
         $dontFallback = config('contentful.payload_fields_not_fallback', []);
85 85
 
86 86
         $fallbackLocale = Locale::fallback($locale);
87
-        $fallbackSecondLevel = ! empty($fallbackLocale) ? Locale::fallback($fallbackLocale) : null;
87
+        $fallbackSecondLevel = !empty($fallbackLocale) ? Locale::fallback($fallbackLocale) : null;
88 88
 
89 89
         foreach ($entry['fields'] as $field => $localesData) {
90 90
             if (isset($localesData[$locale])) {
91 91
                 $payload[$field] = $localesData[$locale];
92 92
             } else {
93
-                if (! in_array($field, $dontFallback) && isset($localesData[$fallbackLocale]) && ($this->levelFallBack($field) === 'all')) {
93
+                if (!in_array($field, $dontFallback) && isset($localesData[$fallbackLocale]) && ($this->levelFallBack($field) === 'all')) {
94 94
                     $payload[$field] = $localesData[$fallbackLocale];
95 95
                 } else {
96
-                    if (! empty($fallbackSecondLevel) && ! in_array($field, $dontFallback) && isset($localesData[$fallbackSecondLevel]) && ($this->levelFallBack($field) === 'all')) {
96
+                    if (!empty($fallbackSecondLevel) && !in_array($field, $dontFallback) && isset($localesData[$fallbackSecondLevel]) && ($this->levelFallBack($field) === 'all')) {
97 97
                         $payload[$field] = $localesData[$fallbackSecondLevel];
98 98
                     } else {
99 99
                         $payload[$field] = null;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             if (is_array($value)) {
138 138
                 if ($this->isLink($value)) {
139 139
                     try {
140
-                        $relationships[] = $this->relationshipSignature($value,$field);
140
+                        $relationships[] = $this->relationshipSignature($value, $field);
141 141
                     } catch (Exception $e) {
142 142
                         //
143 143
                     }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
                     foreach ($value as $entry) {
146 146
                         if ($this->isLink($entry)) {
147 147
                             try {
148
-                                $relationships[] = $this->relationshipSignature($entry,$field);
148
+                                $relationships[] = $this->relationshipSignature($entry, $field);
149 149
                             } catch (Exception $e) {
150 150
                                 //
151 151
                             }
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             }
185 185
         }
186 186
 
187
-        throw new Exception('Invalid field signature... ' . PHP_EOL . print_r($localeField, true));
187
+        throw new Exception('Invalid field signature... '.PHP_EOL.print_r($localeField, true));
188 188
     }
189 189
 
190 190
     /**
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
                     'content_type' => 'single_entry',
221 221
                 ]);
222 222
 
223
-                if (! empty($entry) && ! empty($entry['sys']['contentType']) && ! empty($entry['sys']['contentType']['sys'])) {
223
+                if (!empty($entry) && !empty($entry['sys']['contentType']) && !empty($entry['sys']['contentType']['sys'])) {
224 224
                     $this->upsertEntryType($entry, $entry['sys']['contentType']['sys']['id']);
225 225
 
226 226
                     return $entry['sys']['contentType']['sys']['id'];
227 227
                 }
228 228
             } catch (Exception $e) {
229
-                throw new Exception('Unknown content-type from synced entry: ' . $contentfulId);
229
+                throw new Exception('Unknown content-type from synced entry: '.$contentfulId);
230 230
             }
231 231
         }
232 232
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     {
248 248
         $locales = [];
249 249
 
250
-        if (isset($entry['fields']) && ! empty($entry['fields'])) {
250
+        if (isset($entry['fields']) && !empty($entry['fields'])) {
251 251
             $firstField = Arr::first($entry['fields']);
252 252
             $locales = array_keys($firstField);
253 253
         }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Base/ContentfulModel.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
     {
46 46
         // Override fillable
47 47
         foreach ($this->defaultFillable() as $defaultFillable) {
48
-            if (! in_array($defaultFillable, $this->fillable)) {
48
+            if (!in_array($defaultFillable, $this->fillable)) {
49 49
                 $this->fillable[] = $defaultFillable;
50 50
             }
51 51
         }
52 52
 
53 53
         // Override casts
54 54
         foreach ($this->defaultCasts() as $field => $type) {
55
-            if (! isset($this->casts[$field])) {
55
+            if (!isset($this->casts[$field])) {
56 56
                 $this->casts[$field] = $type;
57 57
             }
58 58
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     protected function getAndSetPayloadContentfulAsset(string $payload, $link, $query = null): ?Asset
119 119
     {
120
-        if (! isset($this->attributes[$payload]) && isset($this->payload[$payload])) {
120
+        if (!isset($this->attributes[$payload]) && isset($this->payload[$payload])) {
121 121
             $this->attributes[$payload] = $this->contentfulAsset($link, $query);
122 122
             return $this->attributes[$payload];
123 123
         } else {
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
             ->where('locale', '=', $this->locale)
150 150
             ->where('country', '=', $this->country);
151 151
 
152
-        if (! empty($query)) {
152
+        if (!empty($query)) {
153 153
             $instance = call_user_func($query, $instance);
154 154
         }
155 155
 
156 156
         $asset = $instance->first();
157 157
 
158
-        return ! empty($asset) ? $asset : null;
158
+        return !empty($asset) ? $asset : null;
159 159
     }
160 160
 
161 161
     /**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     protected function getAndSetPayloadContentfulEntries(string $payload, array $links, $query = null): Collection
170 170
     {
171
-        if (! isset($this->attributes[$payload]) && isset($this->payload[$payload])) {
171
+        if (!isset($this->attributes[$payload]) && isset($this->payload[$payload])) {
172 172
             $this->attributes[$payload] = $this->contentfulEntries($links, $query, $payload);
173 173
 
174 174
             return $this->attributes[$payload];
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     protected function getAndSetPayloadContentfulEntry(string $payload, array $links, $query = null): ?ContentfulModel
193 193
     {
194
-        if (! isset($this->attributes[$payload]) && isset($this->payload[$payload])) {
194
+        if (!isset($this->attributes[$payload]) && isset($this->payload[$payload])) {
195 195
             $this->attributes[$payload] = $this->contentfulEntry($links, $query, $payload);
196 196
 
197 197
             return $this->attributes[$payload];
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
         $entryIds = [];
241 241
         foreach ($links as $link) {
242 242
             $entryId = $this->contentfulLinkId($link);
243
-            if (! empty($entryId)) {
243
+            if (!empty($entryId)) {
244 244
                 $entryIds[] = $entryId;
245 245
             }
246 246
         }
247 247
 
248
-        if (! empty($entryIds)) {
248
+        if (!empty($entryIds)) {
249 249
             $relationships = EntryRelationship::select('related_contentful_id', 'related_contentful_type')
250 250
                 ->distinct()
251 251
                 ->locale($this->locale, $this->country)
@@ -262,20 +262,20 @@  discard block
 block discarded – undo
262 262
                     $model = NamespaceResolver::model($relationship->related_contentful_type);
263 263
                 }
264 264
 
265
-                if (! empty($model)) {
265
+                if (!empty($model)) {
266 266
                     $instance = $model->query()
267 267
                         ->where('country', '=', $this->country)
268 268
                         ->where('locale', '=', $this->locale)
269 269
                         ->where('contentful_id', '=', $relationship->related_contentful_id);
270 270
 
271
-                    if (! empty($query)) {
271
+                    if (!empty($query)) {
272 272
                         $instance = call_user_func($query, $instance);
273 273
                     }
274 274
 
275 275
                     $instance = $instance->first();
276 276
                 }
277 277
 
278
-                if (! empty($instance)) {
278
+                if (!empty($instance)) {
279 279
                     $entries[] = $instance;
280 280
                 }
281 281
             }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             ->locale($this->locale, $this->country)
300 300
             ->where('related_contentful_id', '=', $contentfulId);
301 301
 
302
-        if (! empty($contentfulType)) {
302
+        if (!empty($contentfulType)) {
303 303
             $query = $query->where('source_contentful_type', '=', $contentfulType);
304 304
         }
305 305
 
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
                 $model = NamespaceResolver::model($relationship->related_contentful_type);
312 312
             }
313 313
 
314
-            $instance = ! empty($model) ? $model->query()
314
+            $instance = !empty($model) ? $model->query()
315 315
                 ->locale($this->locale, $this->country)
316 316
                 ->where('contentful_id', '=', $relationship->source_contentful_id)
317 317
                 ->first() : null;
318 318
 
319
-            if (! empty($instance)) {
319
+            if (!empty($instance)) {
320 320
                 $entries[] = $instance;
321 321
             }
322 322
         }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         $array = parent::toArray();
376 376
 
377 377
         foreach ($this->getMutatedAttributes() as $key) {
378
-            if (! array_key_exists($key, $array)) {
378
+            if (!array_key_exists($key, $array)) {
379 379
                 $array[$key] = $this->{$key};
380 380
             }
381 381
         }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Traits/Localable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@
 block discarded – undo
19 19
      */
20 20
     public function scopeLocale($query, ?string $locale = '', ?string $country = ''): Builder
21 21
     {
22
-        $locale = ! empty($locale) ? $locale : Locale::getAppOrDefaultLocale();
23
-        $country = ! empty($country) ? $country : Locale::getAppOrDefaultCountry();
22
+        $locale = !empty($locale) ? $locale : Locale::getAppOrDefaultLocale();
23
+        $country = !empty($country) ? $country : Locale::getAppOrDefaultCountry();
24 24
 
25 25
         return $query
26
-            ->whereRaw('LOWER(' . $this->getTable() . '.country) LIKE LOWER("' . $country . '")')
27
-            ->whereRaw('LOWER(' . $this->getTable() . '.locale) LIKE LOWER("' . $locale . '")');
26
+            ->whereRaw('LOWER('.$this->getTable().'.country) LIKE LOWER("'.$country.'")')
27
+            ->whereRaw('LOWER('.$this->getTable().'.locale) LIKE LOWER("'.$locale.'")');
28 28
     }
29 29
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/EntryRelationship.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,8 @@
 block discarded – undo
59 59
      */
60 60
     public function getRelatedEntry()
61 61
     {
62
-        $localModel = rtrim(config('contentful.namespaces.model'), '\\') . '\\' . ucfirst($this->source_contentful_type);
63
-        if (! class_exists($localModel)) {
62
+        $localModel = rtrim(config('contentful.namespaces.model'), '\\').'\\'.ucfirst($this->source_contentful_type);
63
+        if (!class_exists($localModel)) {
64 64
             return null;
65 65
         }
66 66
 
Please login to merge, or discard this patch.