@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | public function apply(Builder $builder, Model $model) |
20 | 20 | { |
21 | 21 | $builder |
22 | - ->where(function ($query) use ($model) { |
|
22 | + ->where(function($query) use ($model) { |
|
23 | 23 | $query |
24 | - ->whereNull($model->getTable() . '.validated_at') |
|
25 | - ->orWhere($model->getTable() . '.validated_at','>=',Carbon::now()->format('Y-m-d H:i:s')); |
|
24 | + ->whereNull($model->getTable().'.validated_at') |
|
25 | + ->orWhere($model->getTable().'.validated_at', '>=', Carbon::now()->format('Y-m-d H:i:s')); |
|
26 | 26 | }); |
27 | 27 | |
28 | 28 | $this->extend($builder); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function extend(Builder $builder) |
38 | 38 | { |
39 | - $builder->macro('withoutValidated', function (Builder $builder) { |
|
39 | + $builder->macro('withoutValidated', function(Builder $builder) { |
|
40 | 40 | return $builder->withoutGlobalScope($this); |
41 | 41 | }); |
42 | 42 | } |
@@ -70,8 +70,8 @@ |
||
70 | 70 | */ |
71 | 71 | public function getRelatedEntry() |
72 | 72 | { |
73 | - $localModel = rtrim(config('contentful.namespaces.model'), '\\') . '\\' . ucfirst($this->src_content_type); |
|
74 | - if (! class_exists($localModel)) { |
|
73 | + $localModel = rtrim(config('contentful.namespaces.model'), '\\').'\\'.ucfirst($this->src_content_type); |
|
74 | + if (!class_exists($localModel)) { |
|
75 | 75 | return null; |
76 | 76 | } |
77 | 77 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('use_contentful_preview')) { |
|
3 | +if (!function_exists('use_contentful_preview')) { |
|
4 | 4 | /** |
5 | 5 | * Use Contentful preview switch setup. |
6 | 6 | * |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | function use_contentful_preview(bool $state = true) |
11 | 11 | { |
12 | - if (! empty($state)) { |
|
12 | + if (!empty($state)) { |
|
13 | 13 | config([ |
14 | 14 | 'database.default' => 'mysql_preview', |
15 | 15 | 'contentful.use_preview' => 1, |
@@ -77,7 +77,7 @@ |
||
77 | 77 | { |
78 | 78 | $indexed = []; |
79 | 79 | |
80 | - $locale = ! empty($locale) ? $locale : Locale::default(); |
|
80 | + $locale = !empty($locale) ? $locale : Locale::default(); |
|
81 | 81 | foreach ($data as $field => $value) { |
82 | 82 | $indexed[$field][$locale] = $value; |
83 | 83 | } |
@@ -42,5 +42,5 @@ |
||
42 | 42 | 'replace_host' => 'images.ctfassets.net', |
43 | 43 | ], |
44 | 44 | |
45 | - 'payload_fields_not_fallback' => explode(',',env('CONTENTFUL_PAYLOAD_FIELD_NOT_FALLBACK', '')) |
|
45 | + 'payload_fields_not_fallback' => explode(',', env('CONTENTFUL_PAYLOAD_FIELD_NOT_FALLBACK', '')) |
|
46 | 46 | ]; |
47 | 47 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | public function modelGetter() |
11 | 11 | { |
12 | - $stubPath = __DIR__ . '/stubs/string.stub'; |
|
12 | + $stubPath = __DIR__.'/stubs/string.stub'; |
|
13 | 13 | |
14 | 14 | return self::getStub($stubPath, [ |
15 | 15 | 'field_camel' => studly_case($this->id()), |
@@ -132,12 +132,12 @@ |
||
132 | 132 | private function fieldsWithFallback(array $fields, string $locale): array |
133 | 133 | { |
134 | 134 | $fallbackLocale = Locale::fallback($locale); |
135 | - $file = $this->getFieldValue($fields, 'file', $locale, $fallbackLocale,[]); |
|
135 | + $file = $this->getFieldValue($fields, 'file', $locale, $fallbackLocale, []); |
|
136 | 136 | $details = isset($file['details']) ? $file['details'] : []; |
137 | 137 | |
138 | 138 | return [ |
139 | - 'title' => $this->getFieldValue($fields, 'title', $locale, $fallbackLocale,''), |
|
140 | - 'description' => $this->getFieldValue($fields, 'description', $locale, $fallbackLocale,''), |
|
139 | + 'title' => $this->getFieldValue($fields, 'title', $locale, $fallbackLocale, ''), |
|
140 | + 'description' => $this->getFieldValue($fields, 'description', $locale, $fallbackLocale, ''), |
|
141 | 141 | 'url' => isset($file['url']) ? $file['url'] : '', |
142 | 142 | 'file_name' => isset($file['fileName']) ? $file['fileName'] : '', |
143 | 143 | 'content_type' => isset($file['contentType']) ? $file['contentType'] : '', |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | 'fm' => config('contentful.image.use_webp') ? $format : null, |
41 | 41 | 'fl' => static::detectProgressive($format, $useProgressive) ? 'progressive' : null, |
42 | 42 | 'fit' => static::detectFit($fit), |
43 | - ])->filter(function ($value) { |
|
43 | + ])->filter(function($value) { |
|
44 | 44 | return !empty($value); |
45 | - })->each(function ($value, $key) use (& $imageUrl) { |
|
46 | - $imageUrl .= $key . '=' . $value . '&'; |
|
45 | + })->each(function($value, $key) use (& $imageUrl) { |
|
46 | + $imageUrl .= $key.'='.$value.'&'; |
|
47 | 47 | }); |
48 | 48 | |
49 | 49 | return static::replaceHosts($url, $imageUrl); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $url = str_replace(explode(',', $searchHosts), $replaceHost, $url); |
68 | 68 | } |
69 | 69 | |
70 | - return !empty($url) ? $url . '?' . trim($imageUrl, '&') : ''; |
|
70 | + return !empty($url) ? $url.'?'.trim($imageUrl, '&') : ''; |
|
71 | 71 | |
72 | 72 | } |
73 | 73 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | $modelPath = config('contentful.generator.model'); |
26 | 26 | |
27 | - foreach (glob($modelPath . '/*.php') as $file) { |
|
27 | + foreach (glob($modelPath.'/*.php') as $file) { |
|
28 | 28 | $modelInstance = NamespaceResolver::model(str_replace( |
29 | 29 | [$modelPath, '.php', '/'], |
30 | 30 | ['', '', '\\'], |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | */ |
111 | 111 | private function entryMapper(array $entry): ContentfulMapper |
112 | 112 | { |
113 | - $class = studly_case($this->entryContentType($entry)) . 'Mapper'; |
|
113 | + $class = studly_case($this->entryContentType($entry)).'Mapper'; |
|
114 | 114 | $mapperClass = NamespaceResolver::mapper($class); |
115 | 115 | |
116 | 116 | if (empty($mapperClass) && !($mapperClass instanceof ContentfulMapper)) { |
117 | - throw new Exception('Unknown mapper: ' . $class); |
|
117 | + throw new Exception('Unknown mapper: '.$class); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return new $mapperClass; |
@@ -133,7 +133,7 @@ discard block |
||
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; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $order = 1; |
172 | 172 | foreach ($relationships as $relationship) { |
173 | 173 | if (!isset($relationship['id']) || !isset($relationship['type'])) { |
174 | - throw new Exception('Relationships malformed! (' . print_r($relationship, true) . ')'); |
|
174 | + throw new Exception('Relationships malformed! ('.print_r($relationship, true).')'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | DB::table('entry_relationships')->insert([ |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | } |
231 | 231 | |
232 | 232 | if (!isset($data['payload'])) { |
233 | - throw new Exception('Mapper for model ' . class_basename($model) . ' must set a "payload" key'); |
|
233 | + throw new Exception('Mapper for model '.class_basename($model).' must set a "payload" key'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | $instance = $this->instanceQueryBuilder($model, $data)->first(); |