@@ -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 | } |
@@ -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'])) { |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | return [ |
49 | - 'title' => ! empty($model->title) ? $model->title : null, |
|
50 | - 'description' => ! empty($model->description) ? $model->description : null, |
|
49 | + 'title' => !empty($model->title) ? $model->title : null, |
|
50 | + 'description' => !empty($model->description) ? $model->description : null, |
|
51 | 51 | 'url' => $url, |
52 | 52 | ]; |
53 | 53 | } |
@@ -61,15 +61,15 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function transformCollection(Collection $collection, array $parameters = []): Collection |
63 | 63 | { |
64 | - $collection->filter(function ($value) { |
|
65 | - return ! empty($value); |
|
64 | + $collection->filter(function($value) { |
|
65 | + return !empty($value); |
|
66 | 66 | }); |
67 | 67 | |
68 | 68 | if ($collection->isEmpty()) { |
69 | 69 | return collect(); |
70 | 70 | } |
71 | 71 | |
72 | - return $collection->transform(function ($model) use ($parameters) { |
|
72 | + return $collection->transform(function($model) use ($parameters) { |
|
73 | 73 | return $this->transform($model, $parameters); |
74 | 74 | }); |
75 | 75 | } |