@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function handle(string $action, array $payload, bool $isPreview) |
| 37 | 37 | { |
| 38 | 38 | $actionMethods = ['create', 'archive', 'unarchive', 'publish', 'unpublish', 'delete']; |
| 39 | - $actionMethods = ! empty($isPreview) ? array_merge($actionMethods, ['save', 'auto_save']) : $actionMethods; |
|
| 39 | + $actionMethods = !empty($isPreview) ? array_merge($actionMethods, ['save', 'auto_save']) : $actionMethods; |
|
| 40 | 40 | |
| 41 | 41 | if (method_exists($this, $action) && in_array($action, $actionMethods)) { |
| 42 | 42 | $this->$action($payload); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $this->client = $client; |
| 47 | 47 | |
| 48 | 48 | $this->config = config('contentful', []); |
| 49 | - $this->config = ! is_array($this->config) ? (array)$this->config : $this->config; |
|
| 49 | + $this->config = !is_array($this->config) ? (array) $this->config : $this->config; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | // Mandatory to make sure we have the last version modified by the scripts |
| 63 | 63 | $this->config['use_preview'] = config('contentful.use_preview'); |
| 64 | 64 | |
| 65 | - if ((isset($this->config['use_preview']) && $this->config['use_preview'] == true) && ! empty($this->previewBaseUrl)) { |
|
| 65 | + if ((isset($this->config['use_preview']) && $this->config['use_preview'] == true) && !empty($this->previewBaseUrl)) { |
|
| 66 | 66 | $baseUrl = rtrim($this->previewBaseUrl, '/'); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $environment = (isset($this->config['use_environment']) && $this->config['use_environment'] == true) ? '/environments/' . $this->config['environment'] . '/' : '/'; |
|
| 69 | + $environment = (isset($this->config['use_environment']) && $this->config['use_environment'] == true) ? '/environments/'.$this->config['environment'].'/' : '/'; |
|
| 70 | 70 | |
| 71 | - return $baseUrl . '/spaces/' . $this->config['space_id'] . $environment . trim($endpoint, '/'); |
|
| 71 | + return $baseUrl.'/spaces/'.$this->config['space_id'].$environment.trim($endpoint, '/'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -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 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function processAsset(string $assetId, string $locale, int $version = 1) |
| 183 | 183 | { |
| 184 | - $this->client->request('PUT', $this->url('environments/master/assets/' . $assetId . '/files/' . $locale . '/process'), [ |
|
| 184 | + $this->client->request('PUT', $this->url('environments/master/assets/'.$assetId.'/files/'.$locale.'/process'), [ |
|
| 185 | 185 | RequestOptions::HEADERS => $this->headers([ |
| 186 | 186 | 'X-Contentful-Version' => $version, |
| 187 | 187 | ]), |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function publishAsset(string $assetId, int $version = 1): array |
| 195 | 195 | { |
| 196 | - $response = $this->client->request('PUT', $this->url('assets/' . $assetId . '/published'), [ |
|
| 196 | + $response = $this->client->request('PUT', $this->url('assets/'.$assetId.'/published'), [ |
|
| 197 | 197 | RequestOptions::HEADERS => $this->headers([ |
| 198 | 198 | 'X-Contentful-Version' => $version, |
| 199 | 199 | ]), |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | public function unpublishAsset(string $assetId): array |
| 209 | 209 | { |
| 210 | - $response = $this->client->request('DELETE', $this->url('assets/' . $assetId . '/published'), [ |
|
| 210 | + $response = $this->client->request('DELETE', $this->url('assets/'.$assetId.'/published'), [ |
|
| 211 | 211 | RequestOptions::HEADERS => $this->headers(), |
| 212 | 212 | ]); |
| 213 | 213 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public function deleteAsset(string $assetId): bool |
| 221 | 221 | { |
| 222 | - $response = $this->client->request('DELETE', $this->url('assets/' . $assetId), [ |
|
| 222 | + $response = $this->client->request('DELETE', $this->url('assets/'.$assetId), [ |
|
| 223 | 223 | RequestOptions::HEADERS => $this->headers(), |
| 224 | 224 | ]); |
| 225 | 225 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | { |
| 241 | 241 | return array_merge([ |
| 242 | 242 | 'Content-Type' => 'application/vnd.contentful.management.v1+json', |
| 243 | - 'Authorization' => 'Bearer ' . $this->config['tokens']['management'], |
|
| 243 | + 'Authorization' => 'Bearer '.$this->config['tokens']['management'], |
|
| 244 | 244 | ], $headers); |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -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 | /** |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public static function location(array $entry, ?Location $default = null): ?Location |
| 177 | 177 | { |
| 178 | - return ! empty($entry)? new Location($entry) : $default; |
|
| 178 | + return !empty($entry) ? new Location($entry) : $default; |
|
| 179 | 179 | } |
| 180 | 180 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | 'fm' => config('contentful.image.use_webp') ? $format : null, |
| 36 | 36 | 'fl' => static::detectProgressive($format, $useProgressive) ? 'progressive' : null, |
| 37 | 37 | 'fit' => static::detectFit($fit), |
| 38 | - ])->filter(function ($value) { |
|
| 38 | + ])->filter(function($value) { |
|
| 39 | 39 | return !empty($value); |
| 40 | - })->each(function ($value, $key) use (& $imageUrl) { |
|
| 41 | - $imageUrl .= $key . '=' . $value . '&'; |
|
| 40 | + })->each(function($value, $key) use (& $imageUrl) { |
|
| 41 | + $imageUrl .= $key.'='.$value.'&'; |
|
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | 44 | return static::replaceHosts($url, $imageUrl); |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $searchHosts = config('contentful.image.search_hosts'); |
| 62 | 62 | $replaceHost = config('contentful.image.replace_host'); |
| 63 | - if (! empty($searchHosts) && ! empty($replaceHost)) { |
|
| 63 | + if (!empty($searchHosts) && !empty($replaceHost)) { |
|
| 64 | 64 | $url = str_replace(explode(',', $searchHosts), $replaceHost, $url); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return ! empty($url) ? $url . '?' . trim($imageUrl, '&') : ''; |
|
| 67 | + return !empty($url) ? $url.'?'.trim($imageUrl, '&') : ''; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if ($useProgressive === null) { |
| 122 | - $useProgressive = ! empty(config('contentful.image.use_progressive')); |
|
| 122 | + $useProgressive = !empty(config('contentful.image.use_progressive')); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $useProgressive; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $class = static::modelClass($model); |
| 31 | 31 | |
| 32 | - if (! empty($class)) { |
|
| 32 | + if (!empty($class)) { |
|
| 33 | 33 | $model = new $class; |
| 34 | 34 | return $model instanceof ContentfulModel ? $model : null; |
| 35 | 35 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $class = static::mapperClass($mapper); |
| 60 | 60 | |
| 61 | - if (! empty($class)) { |
|
| 61 | + if (!empty($class)) { |
|
| 62 | 62 | return new $class; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | public static function load(string $key, string $element): ?string |
| 76 | 76 | { |
| 77 | 77 | foreach (config($key, []) as $namespace) { |
| 78 | - $modelClass = rtrim($namespace, '\\') . '\\' . ltrim(Str::studly($element), '\\'); |
|
| 78 | + $modelClass = rtrim($namespace, '\\').'\\'.ltrim(Str::studly($element), '\\'); |
|
| 79 | 79 | if (class_exists($modelClass)) { |
| 80 | 80 | return $modelClass; |
| 81 | 81 | } |