@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | public function modelGetter() |
12 | 12 | { |
13 | - $stubPath = __DIR__ . '/stubs/float.stub'; |
|
13 | + $stubPath = __DIR__.'/stubs/float.stub'; |
|
14 | 14 | |
15 | 15 | return self::getStub($stubPath, [ |
16 | 16 | 'field_camel' => studly_case($this->id()), |
@@ -13,13 +13,13 @@ |
||
13 | 13 | { |
14 | 14 | switch ($this->field['items']['type']) { |
15 | 15 | case 'Link': |
16 | - $stubPath = __DIR__ . '/stubs/entries.stub'; |
|
16 | + $stubPath = __DIR__.'/stubs/entries.stub'; |
|
17 | 17 | break; |
18 | 18 | case 'Symbol': |
19 | - $stubPath = __DIR__ . '/stubs/string.stub'; |
|
19 | + $stubPath = __DIR__.'/stubs/string.stub'; |
|
20 | 20 | break; |
21 | 21 | default: |
22 | - throw new Exception('Unknown Array items type "' . $this->field['items']['type'] . '"'); |
|
22 | + throw new Exception('Unknown Array items type "'.$this->field['items']['type'].'"'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | return self::getStub($stubPath, [ |
@@ -9,7 +9,7 @@ |
||
9 | 9 | */ |
10 | 10 | public function modelGetter() |
11 | 11 | { |
12 | - $stubPath = __DIR__ . '/stubs/string.stub'; |
|
12 | + $stubPath = __DIR__.'/stubs/string.stub'; |
|
13 | 13 | |
14 | 14 | return self::getStub($stubPath, [ |
15 | 15 | 'field_camel' => studly_case($this->id()), |
@@ -13,13 +13,13 @@ |
||
13 | 13 | { |
14 | 14 | switch ($this->field['linkType']) { |
15 | 15 | case 'Entry': |
16 | - $stubPath = __DIR__ . '/stubs/entry.stub'; |
|
16 | + $stubPath = __DIR__.'/stubs/entry.stub'; |
|
17 | 17 | break; |
18 | 18 | case 'Asset': |
19 | - $stubPath = __DIR__ . '/stubs/asset.stub'; |
|
19 | + $stubPath = __DIR__.'/stubs/asset.stub'; |
|
20 | 20 | break; |
21 | 21 | default: |
22 | - throw new Exception('Unknown Array items type "' . $this->field['linkType'] . '"'); |
|
22 | + throw new Exception('Unknown Array items type "'.$this->field['linkType'].'"'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | return self::getStub($stubPath, [ |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $content = file_get_contents($stubPath); |
61 | 61 | |
62 | 62 | foreach ($replacements as $key => $value) { |
63 | - $content = str_replace('{{' . mb_strtoupper($key) . '}}', $value, $content); |
|
63 | + $content = str_replace('{{'.mb_strtoupper($key).'}}', $value, $content); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $content; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected function tableName($id) |
38 | 38 | { |
39 | - return DB::getTablePrefix() . str_plural(snake_case($id)); |
|
39 | + return DB::getTablePrefix().str_plural(snake_case($id)); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $content = file_get_contents($stubPath); |
55 | 55 | foreach ($replacements as $key => $value) { |
56 | - $content = str_replace('{{' . mb_strtoupper($key) . '}}', $value, $content); |
|
56 | + $content = str_replace('{{'.mb_strtoupper($key).'}}', $value, $content); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | file_put_contents($destPath, $content); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | ]], |
97 | 97 | ]; |
98 | 98 | |
99 | - $assetContentType['fields'] = array_map(function ($field) { |
|
100 | - if (! isset($field['required'])) { |
|
99 | + $assetContentType['fields'] = array_map(function($field) { |
|
100 | + if (!isset($field['required'])) { |
|
101 | 101 | $field['required'] = true; |
102 | 102 | } |
103 | 103 | $field['disabled'] = false; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function fieldDefinition($table, $field): ?DefinitionInterface |
120 | 120 | { |
121 | - $className = '\Distilleries\Contentful\Commands\Generators\Definitions\\' . $field['type'] . 'Definition'; |
|
121 | + $className = '\Distilleries\Contentful\Commands\Generators\Definitions\\'.$field['type'].'Definition'; |
|
122 | 122 | |
123 | 123 | if (class_exists($className)) { |
124 | 124 | return new $className($table, $field); |
@@ -135,6 +135,6 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function isFieldEnabled($field): bool |
137 | 137 | { |
138 | - return ! $field['disabled'] && ! $field['omitted']; |
|
138 | + return !$field['disabled'] && !$field['omitted']; |
|
139 | 139 | } |
140 | 140 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | { |
26 | 26 | $contentTypes = $this->api->contentTypes(); |
27 | 27 | |
28 | - if (! empty($contentTypes['items'])) { |
|
28 | + if (!empty($contentTypes['items'])) { |
|
29 | 29 | array_unshift($contentTypes['items'], $this->assetContentType()); |
30 | 30 | |
31 | 31 | foreach ($contentTypes['items'] as $contentType) { |
32 | - $this->info('Content-Type: ' . mb_strtoupper($contentType['name'])); |
|
32 | + $this->info('Content-Type: '.mb_strtoupper($contentType['name'])); |
|
33 | 33 | $file = $this->createMapper($contentType); |
34 | - $this->line('Mapper "' . $file . '" created'); |
|
34 | + $this->line('Mapper "'.$file.'" created'); |
|
35 | 35 | $file = $this->createModel($contentType); |
36 | - $this->line('Model "' . $file . '" created'); |
|
36 | + $this->line('Model "'.$file.'" created'); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $table = $this->tableName($contentType['sys']['id']); |
51 | 51 | $model = studly_case(str_singular($table)); |
52 | 52 | |
53 | - $stubPath = __DIR__ . '/stubs/model.stub'; |
|
54 | - $destPath = rtrim(config('contentful.generator.model'), '/') . '/' . $model . '.php'; |
|
53 | + $stubPath = __DIR__.'/stubs/model.stub'; |
|
54 | + $destPath = rtrim(config('contentful.generator.model'), '/').'/'.$model.'.php'; |
|
55 | 55 | |
56 | 56 | return static::writeStub($stubPath, $destPath, [ |
57 | 57 | 'model' => $model, |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | $table = $this->tableName($contentType['sys']['id']); |
72 | 72 | $model = studly_case(str_singular($table)); |
73 | 73 | |
74 | - $stubPath = __DIR__ . '/stubs/mapper.stub'; |
|
75 | - $destPath = rtrim(config('contentful.generator.mapper'), '/') . '/' . $model . 'Mapper.php'; |
|
74 | + $stubPath = __DIR__.'/stubs/mapper.stub'; |
|
75 | + $destPath = rtrim(config('contentful.generator.mapper'), '/').'/'.$model.'Mapper.php'; |
|
76 | 76 | |
77 | 77 | return static::writeStub($stubPath, $destPath, [ |
78 | 78 | 'model' => $model |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return "\t\t//"; |
101 | 101 | } |
102 | 102 | |
103 | - return implode("\n\n", array_map(function ($getter) { |
|
103 | + return implode("\n\n", array_map(function($getter) { |
|
104 | 104 | return $getter; |
105 | 105 | }, $getters)); |
106 | 106 | } |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | { |
28 | 28 | $contentTypes = $this->api->contentTypes(); |
29 | 29 | |
30 | - if (! empty($contentTypes['items'])) { |
|
30 | + if (!empty($contentTypes['items'])) { |
|
31 | 31 | array_unshift($contentTypes['items'], $this->assetContentType()); |
32 | 32 | foreach ($contentTypes['items'] as $contentType) { |
33 | - $this->info('Content-Type: ' . mb_strtoupper($contentType['name'])); |
|
33 | + $this->info('Content-Type: '.mb_strtoupper($contentType['name'])); |
|
34 | 34 | $file = $this->createMigration($contentType); |
35 | - $this->line('Migration "' . $file . '" created'); |
|
35 | + $this->line('Migration "'.$file.'" created'); |
|
36 | 36 | sleep(1); |
37 | 37 | } |
38 | 38 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | { |
50 | 50 | $table = $this->tableName($contentType['sys']['id']); |
51 | 51 | |
52 | - $stubPath = __DIR__ . '/stubs/migration.stub'; |
|
53 | - $destPath = database_path('migrations/' . Carbon::now()->format('Y_m_d_His') . '_create_' . $table . '_table.php'); |
|
52 | + $stubPath = __DIR__.'/stubs/migration.stub'; |
|
53 | + $destPath = database_path('migrations/'.Carbon::now()->format('Y_m_d_His').'_create_'.$table.'_table.php'); |
|
54 | 54 | |
55 | 55 | return static::writeStub($stubPath, $destPath, [ |
56 | 56 | 'class' => studly_case($table), |
@@ -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); |