Completed
Push — master ( 5eb1c0...f4588e )
by Maxime
17:35 queued 08:36
created
src/Distilleries/Contentful/Commands/Sync/SyncFlatten.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -199,6 +199,7 @@  discard block
 block discarded – undo
199 199
     /**
200 200
      * Update progress from other threads.
201 201
      *
202
+     * @param ProgressBar $bar
202 203
      * @return void
203 204
      */
204 205
     protected function updateFromOtherThread($bar)
@@ -209,6 +210,7 @@  discard block
 block discarded – undo
209 210
     /**
210 211
      * Get current release.
211 212
      *
213
+     * @return Release
212 214
      */
213 215
     protected function getCurrentRelease(Release $release)
214 216
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         $bar = $this->createProgressBar($paginator->total());
145 145
         while ($paginator->isNotEmpty()) {
146 146
             foreach ($paginator->items() as $item) {
147
-                $bar->setMessage('Map entry ID: ' . $item->contentful_id);
147
+                $bar->setMessage('Map entry ID: '.$item->contentful_id);
148 148
                 $this->mapItemToContentfulModel($item, $locales);
149 149
                 $bar->advance();
150 150
             }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
                 $this->updateFromOtherThread($bar);
170 170
                 $items = collect();
171 171
 
172
-                DB::transaction(function () use ($release, & $items) {
172
+                DB::transaction(function() use ($release, & $items) {
173 173
                     $items = DB::table('sync_entries')
174 174
                         ->whereNull('release_id')
175 175
                         ->take(static::PER_BATCH)
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
                 $items = collect();
186 186
             }
187 187
 
188
-            $items->each(function ($item, $key) use ($locales, $bar) {
189
-                $bar->setMessage('Map entry ID: ' . $item->contentful_id);
188
+            $items->each(function($item, $key) use ($locales, $bar) {
189
+                $bar->setMessage('Map entry ID: '.$item->contentful_id);
190 190
                 $this->mapItemToContentfulModel($item, $locales);
191 191
                 $bar->advance();
192 192
             });
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $bar = $this->output->createProgressBar($total);
228 228
 
229
-        $bar->setFormat("%message%" . PHP_EOL . " %current%/%max% [%bar%] %percent:3s%%");
229
+        $bar->setFormat("%message%".PHP_EOL." %current%/%max% [%bar%] %percent:3s%%");
230 230
 
231 231
         return $bar;
232 232
     }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Commands/Sync/Traits/SyncTrait.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 
5 5
 trait SyncTrait
6 6
 {
7
+    /**
8
+     * @param string $string
9
+     */
7 10
     abstract  public function warn($string, $verbosity = null);
8 11
 
9 12
     /**
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
      */
29 29
     protected function dumpSync(bool $isPreview, string $connector = 'mysql'): string
30 30
     {
31
-        $path = storage_path('dumps/' . date('YmdHis') . '_sync' . ($isPreview ? '_preview' : '') . '.sql');
32
-        $this->warn('Dump "' . basename($path) . '"...');
31
+        $path = storage_path('dumps/'.date('YmdHis').'_sync'.($isPreview ? '_preview' : '').'.sql');
32
+        $this->warn('Dump "'.basename($path).'"...');
33 33
 
34 34
         $dirName = dirname($path);
35 35
         if (!is_dir($dirName)) {
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
         $exec = 'export MYSQL_PWD=\'%s\'; mysqldump --add-drop-table --default-character-set=%s %s -u %s -h %s --port %s > %s';
54 54
 
55 55
         $command = sprintf($exec,
56
-            addcslashes(config('database.connections.' . $connector . '.password'), "'"),
57
-            config('database.connections.' . $connector . '.charset'),
58
-            config('database.connections.' . $connector . '.database'),
59
-            config('database.connections.' . $connector . '.username'),
60
-            config('database.connections.' . $connector . '.host'),
61
-            config('database.connections.' . $connector . '.port'),
56
+            addcslashes(config('database.connections.'.$connector.'.password'), "'"),
57
+            config('database.connections.'.$connector.'.charset'),
58
+            config('database.connections.'.$connector.'.database'),
59
+            config('database.connections.'.$connector.'.username'),
60
+            config('database.connections.'.$connector.'.host'),
61
+            config('database.connections.'.$connector.'.port'),
62 62
             $path
63 63
         );
64 64
         exec($command);
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
     protected function getConnector(bool $isPreview, string $connector = 'mysql'): string
68 68
     {
69
-        $compiledConnector = $connector . ($isPreview ? '_preview' : '');
70
-        if (empty(config('database.connections.' . $compiledConnector . '.username'))) {
69
+        $compiledConnector = $connector.($isPreview ? '_preview' : '');
70
+        if (empty(config('database.connections.'.$compiledConnector.'.username'))) {
71 71
             $compiledConnector = $connector;
72 72
         }
73 73
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'database.default' => $compiledConnector,
92 92
         ]);
93 93
 
94
-        $this->warn('Put into "' . $compiledConnector . '" database...');
94
+        $this->warn('Put into "'.$compiledConnector.'" database...');
95 95
         $this->putSql($path, $compiledConnector);
96 96
     }
97 97
 
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         $exec = 'export MYSQL_PWD=\'%s\'; mysql -u %s -h %s --port %s %s < %s';
108 108
 
109 109
         $command = sprintf($exec,
110
-            addcslashes(config('database.connections.' . $connector . '.password'), "'"),
111
-            config('database.connections.' . $connector . '.username'),
112
-            config('database.connections.' . $connector . '.host'),
113
-            config('database.connections.' . $connector . '.port'),
114
-            config('database.connections.' . $connector . '.database'),
110
+            addcslashes(config('database.connections.'.$connector.'.password'), "'"),
111
+            config('database.connections.'.$connector.'.username'),
112
+            config('database.connections.'.$connector.'.host'),
113
+            config('database.connections.'.$connector.'.port'),
114
+            config('database.connections.'.$connector.'.database'),
115 115
             $path
116 116
         );
117 117
 
Please login to merge, or discard this patch.
src/Distilleries/Contentful/ServiceProvider.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Webhook/EntryHandler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Webhook/Manager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Contentful/Commands/Generators/Definitions/IntegerDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
      */
10 10
     public function modelGetter()
11 11
     {
12
-        $stubPath = __DIR__ . '/stubs/integer.stub';
12
+        $stubPath = __DIR__.'/stubs/integer.stub';
13 13
 
14 14
         return self::getStub($stubPath, [
15 15
             'field_camel' => studly_case($this->id()),
Please login to merge, or discard this patch.
Contentful/Commands/Generators/Definitions/BooleanDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
      */
10 10
     public function modelGetter()
11 11
     {
12
-        $stubPath = __DIR__ . '/stubs/boolean.stub';
12
+        $stubPath = __DIR__.'/stubs/boolean.stub';
13 13
 
14 14
         return self::getStub($stubPath, [
15 15
             'field_camel' => studly_case($this->id()),
Please login to merge, or discard this patch.
Distilleries/Contentful/Commands/Generators/Definitions/DateDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
      */
10 10
     public function modelGetter()
11 11
     {
12
-        $stubPath = __DIR__ . '/stubs/datetime.stub';
12
+        $stubPath = __DIR__.'/stubs/datetime.stub';
13 13
 
14 14
         return self::getStub($stubPath, [
15 15
             'field_camel' => studly_case($this->id()),
Please login to merge, or discard this patch.
Contentful/Commands/Generators/Definitions/ObjectDefinition.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
      */
10 10
     public function modelGetter()
11 11
     {
12
-        $stubPath = __DIR__ . '/stubs/json.stub';
12
+        $stubPath = __DIR__.'/stubs/json.stub';
13 13
 
14 14
         return self::getStub($stubPath, [
15 15
             'field_camel' => studly_case($this->id()),
Please login to merge, or discard this patch.