@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | try { |
83 | 83 | $assets = $this->api->syncInitial('Asset'); |
84 | - while (! empty($assets)) { |
|
84 | + while (!empty($assets)) { |
|
85 | 85 | $this->saveAssets($assets); |
86 | 86 | $assets = $this->api->syncNext(); |
87 | 87 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | protected function saveAssets(array $assets) |
100 | 100 | { |
101 | - DB::transaction(function () use ($assets) { |
|
101 | + DB::transaction(function() use ($assets) { |
|
102 | 102 | foreach ($assets as $asset) { |
103 | 103 | DB::table('sync_entries')->insert([ |
104 | 104 | 'contentful_id' => $asset['sys']['id'], |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | { |
119 | 119 | try { |
120 | 120 | $entries = $this->api->syncInitial('Entry'); |
121 | - while (! empty($entries)) { |
|
121 | + while (!empty($entries)) { |
|
122 | 122 | $this->saveEntries($entries); |
123 | 123 | $entries = $this->api->syncNext(); |
124 | 124 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function saveEntries(array $entries) |
137 | 137 | { |
138 | - DB::transaction(function () use ($entries) { |
|
138 | + DB::transaction(function() use ($entries) { |
|
139 | 139 | foreach ($entries as $entry) { |
140 | 140 | DB::table('sync_entries')->insert([ |
141 | 141 | 'contentful_id' => $entry['sys']['id'], |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public static function toJson($data, $default = null): string |
53 | 53 | { |
54 | - return ! empty($data) ? json_encode($data): $default; |
|
54 | + return !empty($data) ? json_encode($data) : $default; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -173,6 +173,6 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public static function location(array $entry, ?Location $default = null): ?Location |
175 | 175 | { |
176 | - return !empty($entry)? new Location($entry):$default; |
|
176 | + return !empty($entry) ? new Location($entry) : $default; |
|
177 | 177 | } |
178 | 178 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $useProgressive = false; |
30 | 30 | } |
31 | 31 | if ($useProgressive === null) { |
32 | - $useProgressive = ! empty(config('contentful.image.use_progressive')); |
|
32 | + $useProgressive = !empty(config('contentful.image.use_progressive')); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | if (empty($fit)) { |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | collect([ |
42 | 42 | 'w' => $width, |
43 | 43 | 'h' => $height, |
44 | - 'q' => ! empty($quality) ? $quality : config('contentful.image.default_quality'), |
|
44 | + 'q' => !empty($quality) ? $quality : config('contentful.image.default_quality'), |
|
45 | 45 | 'fm' => config('contentful.image.use_webp') ? $format : null, |
46 | 46 | 'fl' => $useProgressive ? 'progressive' : null, |
47 | 47 | 'fit' => $fit, |
48 | - ])->filter(function ($value) { |
|
49 | - return ! empty($value); |
|
50 | - })->each(function ($value, $key) use (& $imageUrl) { |
|
51 | - $imageUrl .= $key . '=' . $value . '&'; |
|
48 | + ])->filter(function($value) { |
|
49 | + return !empty($value); |
|
50 | + })->each(function($value, $key) use (& $imageUrl) { |
|
51 | + $imageUrl .= $key.'='.$value.'&'; |
|
52 | 52 | }); |
53 | 53 | |
54 | 54 | if (str_contains($url, '?')) { |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | |
59 | 59 | $searchHosts = config('contentful.image.search_hosts'); |
60 | 60 | $replaceHost = config('contentful.image.replace_host'); |
61 | - if (! empty($searchHosts) && ! empty($replaceHost)) { |
|
61 | + if (!empty($searchHosts) && !empty($replaceHost)) { |
|
62 | 62 | $url = str_replace(explode(',', $searchHosts), $replaceHost, $url); |
63 | 63 | } |
64 | 64 | |
65 | - return ! empty($url) ? $url . '?' . trim($imageUrl, '&'): ''; |
|
65 | + return !empty($url) ? $url.'?'.trim($imageUrl, '&') : ''; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | if (empty($format)) { |
80 | 80 | $browser = mb_strtolower($agent->browser()); |
81 | - if (($browser === 'chrome') && ! $agent->isMobile()) { |
|
81 | + if (($browser === 'chrome') && !$agent->isMobile()) { |
|
82 | 82 | $format = config('contentful.image.use_webp') ? 'webp' : null; |
83 | 83 | } |
84 | 84 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $this->client = $client; |
46 | 46 | |
47 | 47 | $this->config = config('contentful', []); |
48 | - $this->config = !is_array($this->config) ? (array)$this->config : $this->config; |
|
48 | + $this->config = !is_array($this->config) ? (array) $this->config : $this->config; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $baseUrl = rtrim($this->previewBaseUrl, '/'); |
66 | 66 | } |
67 | 67 | |
68 | - $environment = (isset($this->config['use_environment']) && $this->config['use_environment'] == true) ? '/environments/' . $this->config['environment'] . '/' : '/'; |
|
69 | - return $baseUrl . '/spaces/' . $this->config['space_id'] . $environment . trim($endpoint, '/'); |
|
68 | + $environment = (isset($this->config['use_environment']) && $this->config['use_environment'] == true) ? '/environments/'.$this->config['environment'].'/' : '/'; |
|
69 | + return $baseUrl.'/spaces/'.$this->config['space_id'].$environment.trim($endpoint, '/'); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -51,9 +51,9 @@ |
||
51 | 51 | */ |
52 | 52 | protected function query(string $endpoint, array $parameters): ResponseInterface |
53 | 53 | { |
54 | - $token = ! empty($this->config['use_preview']) ? 'preview' : 'live'; |
|
54 | + $token = !empty($this->config['use_preview']) ? 'preview' : 'live'; |
|
55 | 55 | |
56 | - $url = isset($parameters['id']) ? $this->url($endpoint) . '/' . $parameters['id'] : $this->url($endpoint); |
|
56 | + $url = isset($parameters['id']) ? $this->url($endpoint).'/'.$parameters['id'] : $this->url($endpoint); |
|
57 | 57 | unset($parameters['id']); |
58 | 58 | |
59 | 59 | return $this->client->request('GET', $url, [ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function keyCache(array $parameters): string |
42 | 42 | { |
43 | - return 'delivery_api_' . (config('contentful.use_preview') ? 'preview_' : '') . md5(json_encode($parameters)); |
|
43 | + return 'delivery_api_'.(config('contentful.use_preview') ? 'preview_' : '').md5(json_encode($parameters)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -59,6 +59,6 @@ discard block |
||
59 | 59 | Cache::forever($keyCache, $data); |
60 | 60 | } |
61 | 61 | |
62 | - return ! empty($data) ? $data : []; |
|
62 | + return !empty($data) ? $data : []; |
|
63 | 63 | } |
64 | 64 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function contentTypeEditorInterface(string $contentTypeId): array |
44 | 44 | { |
45 | - $response = $this->client->request('GET', $this->url('content_types/' . $contentTypeId . '/editor_interface'), [ |
|
45 | + $response = $this->client->request('GET', $this->url('content_types/'.$contentTypeId.'/editor_interface'), [ |
|
46 | 46 | RequestOptions::HEADERS => $this->headers(), |
47 | 47 | ]); |
48 | 48 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $filters = []; |
75 | 75 | $filters['content_type'] = $contentType; |
76 | 76 | foreach ($fields as $field => $value) { |
77 | - $filters['fields.' . $field] = $value; |
|
77 | + $filters['fields.'.$field] = $value; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $response = $this->client->request('GET', $this->url('entries'), [ |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function publishEntry(string $entryId, int $version = 1): array |
112 | 112 | { |
113 | - $response = $this->client->request('PUT', $this->url('entries/' . $entryId . '/published'), [ |
|
113 | + $response = $this->client->request('PUT', $this->url('entries/'.$entryId.'/published'), [ |
|
114 | 114 | RequestOptions::HEADERS => $this->headers([ |
115 | 115 | 'X-Contentful-Version' => $version, |
116 | 116 | ]), |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function unpublishEntry(string $entryId): array |
126 | 126 | { |
127 | - $response = $this->client->request('DELETE', $this->url('entries/' . $entryId . '/published'), [ |
|
127 | + $response = $this->client->request('DELETE', $this->url('entries/'.$entryId.'/published'), [ |
|
128 | 128 | RequestOptions::HEADERS => $this->headers(), |
129 | 129 | ]); |
130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | public function deleteEntry(string $entryId): bool |
138 | 138 | { |
139 | - $response = $this->client->request('DELETE', $this->url('entries/' . $entryId), [ |
|
139 | + $response = $this->client->request('DELETE', $this->url('entries/'.$entryId), [ |
|
140 | 140 | RequestOptions::HEADERS => $this->headers(), |
141 | 141 | ]); |
142 | 142 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function processAsset(string $assetId, string $locale, int $version = 1) |
183 | 183 | { |
184 | 184 | $this->client->request('PUT', |
185 | - $this->url('environments/master/assets/' . $assetId . '/files/' . $locale . '/process'), [ |
|
185 | + $this->url('environments/master/assets/'.$assetId.'/files/'.$locale.'/process'), [ |
|
186 | 186 | RequestOptions::HEADERS => $this->headers([ |
187 | 187 | 'X-Contentful-Version' => $version, |
188 | 188 | ]), |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function publishAsset(string $assetId, int $version = 1): array |
196 | 196 | { |
197 | - $response = $this->client->request('PUT', $this->url('assets/' . $assetId . '/published'), [ |
|
197 | + $response = $this->client->request('PUT', $this->url('assets/'.$assetId.'/published'), [ |
|
198 | 198 | RequestOptions::HEADERS => $this->headers([ |
199 | 199 | 'X-Contentful-Version' => $version, |
200 | 200 | ]), |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function unpublishAsset(string $assetId): array |
210 | 210 | { |
211 | - $response = $this->client->request('DELETE', $this->url('assets/' . $assetId . '/published'), [ |
|
211 | + $response = $this->client->request('DELETE', $this->url('assets/'.$assetId.'/published'), [ |
|
212 | 212 | RequestOptions::HEADERS => $this->headers(), |
213 | 213 | ]); |
214 | 214 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public function deleteAsset(string $assetId): bool |
222 | 222 | { |
223 | - $response = $this->client->request('DELETE', $this->url('assets/' . $assetId), [ |
|
223 | + $response = $this->client->request('DELETE', $this->url('assets/'.$assetId), [ |
|
224 | 224 | RequestOptions::HEADERS => $this->headers(), |
225 | 225 | ]); |
226 | 226 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | { |
242 | 242 | return array_merge([ |
243 | 243 | 'Content-Type' => 'application/vnd.contentful.management.v1+json', |
244 | - 'Authorization' => 'Bearer ' . $this->config['tokens']['management'], |
|
244 | + 'Authorization' => 'Bearer '.$this->config['tokens']['management'], |
|
245 | 245 | ], $headers); |
246 | 246 | } |
247 | 247 | } |
248 | 248 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
22 | 22 | RequestOptions::BODY => file_get_contents($file), |
23 | 23 | RequestOptions::HEADERS => [ |
24 | 24 | 'Content-Type' => 'application/octet-stream', |
25 | - 'Authorization' => 'Bearer ' . $this->config['tokens']['management'], |
|
25 | + 'Authorization' => 'Bearer '.$this->config['tokens']['management'], |
|
26 | 26 | ], |
27 | 27 | ]); |
28 | 28 |
@@ -90,10 +90,10 @@ |
||
90 | 90 | { |
91 | 91 | $this->syncToken = ''; |
92 | 92 | |
93 | - if (isset($response['nextPageUrl']) && ! empty($response['nextPageUrl'])) { |
|
93 | + if (isset($response['nextPageUrl']) && !empty($response['nextPageUrl'])) { |
|
94 | 94 | $data = parse_url($response['nextPageUrl']); |
95 | 95 | |
96 | - if (isset($data['query']) && ! empty($data['query'])) { |
|
96 | + if (isset($data['query']) && !empty($data['query'])) { |
|
97 | 97 | parse_str($data['query'], $params); |
98 | 98 | |
99 | 99 | if (isset($params['sync_token'])) { |