@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | public function boot() |
| 39 | 39 | { |
| 40 | 40 | $this->publishes([ |
| 41 | - __DIR__ . '/../../config/config.php' => base_path('config/' . $this->package . '.php'), |
|
| 41 | + __DIR__.'/../../config/config.php' => base_path('config/'.$this->package.'.php'), |
|
| 42 | 42 | ], 'config'); |
| 43 | 43 | |
| 44 | - $this->loadMigrationsFrom(__DIR__ . '/../../database/migrations/'); |
|
| 44 | + $this->loadMigrationsFrom(__DIR__.'/../../database/migrations/'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function register() |
| 53 | 53 | { |
| 54 | - $this->mergeConfigFrom(__DIR__ . '/../../config/config.php', $this->package); |
|
| 54 | + $this->mergeConfigFrom(__DIR__.'/../../config/config.php', $this->package); |
|
| 55 | 55 | |
| 56 | 56 | $this->app->bind(Api\DeliveryApi::class, Api\Delivery\Cached::class); |
| 57 | 57 | $this->app->bind(Api\ManagementApi::class, Api\Management\Api::class); |
@@ -70,31 +70,31 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | private function registerCommands() |
| 72 | 72 | { |
| 73 | - $this->app->singleton('command.contentful.model', function () { |
|
| 73 | + $this->app->singleton('command.contentful.model', function() { |
|
| 74 | 74 | return new Commands\Generators\Models(app(Api\ManagementApi::class)); |
| 75 | 75 | }); |
| 76 | - $this->app->singleton('command.contentful.migration', function () { |
|
| 76 | + $this->app->singleton('command.contentful.migration', function() { |
|
| 77 | 77 | return new Commands\Generators\Migrations(app(Api\ManagementApi::class)); |
| 78 | 78 | }); |
| 79 | - $this->app->singleton('command.contentful.sync', function () { |
|
| 79 | + $this->app->singleton('command.contentful.sync', function() { |
|
| 80 | 80 | return new Commands\Sync\Sync; |
| 81 | 81 | }); |
| 82 | - $this->app->singleton('command.contentful.sync-switch', function () { |
|
| 82 | + $this->app->singleton('command.contentful.sync-switch', function() { |
|
| 83 | 83 | return new Commands\Sync\SyncSwitch; |
| 84 | 84 | }); |
| 85 | - $this->app->singleton('command.contentful.sync-data', function () { |
|
| 85 | + $this->app->singleton('command.contentful.sync-data', function() { |
|
| 86 | 86 | return new Commands\Sync\SyncData(app(Api\SyncApi::class)); |
| 87 | 87 | }); |
| 88 | - $this->app->singleton('command.contentful.sync-flatten', function () { |
|
| 88 | + $this->app->singleton('command.contentful.sync-flatten', function() { |
|
| 89 | 89 | return new Commands\Sync\SyncFlatten; |
| 90 | 90 | }); |
| 91 | - $this->app->singleton('command.contentful.sync-locales', function () { |
|
| 91 | + $this->app->singleton('command.contentful.sync-locales', function() { |
|
| 92 | 92 | return new Commands\Sync\SyncLocales(app(Api\ManagementApi::class)); |
| 93 | 93 | }); |
| 94 | - $this->app->singleton('command.contentful.import-clean', function () { |
|
| 94 | + $this->app->singleton('command.contentful.import-clean', function() { |
|
| 95 | 95 | return new Commands\Import\ImportClean(app(Api\ManagementApi::class)); |
| 96 | 96 | }); |
| 97 | - $this->app->singleton('command.contentful.import-publish', function () { |
|
| 97 | + $this->app->singleton('command.contentful.import-publish', function() { |
|
| 98 | 98 | return new Commands\Import\ImportPublish(app(Api\ManagementApi::class)); |
| 99 | 99 | }); |
| 100 | 100 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function handle(string $action, array $payload, bool $isPreview) |
| 36 | 36 | { |
| 37 | 37 | $actionMethods = ['create', 'archive', 'unarchive', 'publish', 'unpublish', 'delete']; |
| 38 | - $actionMethods = ! empty($isPreview) ? array_merge($actionMethods, ['save', 'auto_save']): $actionMethods; |
|
| 38 | + $actionMethods = !empty($isPreview) ? array_merge($actionMethods, ['save', 'auto_save']) : $actionMethods; |
|
| 39 | 39 | |
| 40 | 40 | if (method_exists($this, $action) && in_array($action, $actionMethods)) { |
| 41 | 41 | $this->$action($payload); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $locales = Locale::all(); |
| 160 | 160 | $locales = is_array($locales) ? collect($locales) : $locales; |
| 161 | - $this->entries->toContentfulModel($payload,$locales); |
|
| 161 | + $this->entries->toContentfulModel($payload, $locales); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | /** |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | public function handle(array $headers, array $payload, bool $isPreview = false): array |
| 18 | 18 | { |
| 19 | - if (! isset($headers['x-contentful-topic'])) { |
|
| 19 | + if (!isset($headers['x-contentful-topic'])) { |
|
| 20 | 20 | return $this->response('Page not found', 404); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $handler = null; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if (! empty($handler)) { |
|
| 40 | + if (!empty($handler)) { |
|
| 41 | 41 | try { |
| 42 | 42 | $handler->handle($topics[2], $payload, $isPreview); |
| 43 | 43 | } catch (Exception $e) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | return [ |
| 61 | 61 | 'status' => $status, |
| 62 | - 'message' => ! empty($message) ? $message : null, |
|
| 62 | + 'message' => !empty($message) ? $message : null, |
|
| 63 | 63 | ]; |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | try { |
| 55 | 55 | $this->cleanEntry($importEntry); |
| 56 | 56 | } catch (GuzzleException $e) { |
| 57 | - $this->error(PHP_EOL . $e->getMessage()); |
|
| 57 | + $this->error(PHP_EOL.$e->getMessage()); |
|
| 58 | 58 | } |
| 59 | 59 | $bar->advance(); |
| 60 | 60 | } |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | private function cleanEntry(stdClass $entry) |
| 75 | 75 | { |
| 76 | 76 | if ($entry->contentful_type === 'asset') { |
| 77 | - if (! empty($entry->published_at)) { |
|
| 77 | + if (!empty($entry->published_at)) { |
|
| 78 | 78 | $this->api->unpublishAsset($entry->contentful_id); |
| 79 | 79 | } |
| 80 | 80 | $this->api->deleteAsset($entry->contentful_id); |
| 81 | 81 | } else { |
| 82 | - if (! empty($entry->published_at)) { |
|
| 82 | + if (!empty($entry->published_at)) { |
|
| 83 | 83 | $this->api->unpublishEntry($entry->contentful_id); |
| 84 | 84 | } |
| 85 | 85 | $this->api->deleteEntry($entry->contentful_id); |
@@ -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,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 | } |
@@ -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'])) { |