Passed
Pull Request — master (#8)
by
unknown
05:39
created
Distilleries/Contentful/Commands/Generators/Definitions/TextDefinition.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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' => $this->id(),
@@ -22,6 +22,6 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function modelProperty()
24 24
     {
25
-        return ' * @property string $' . $this->snakeId();
25
+        return ' * @property string $'.$this->snakeId();
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
Distilleries/Contentful/Commands/Generators/Definitions/ArrayDefinition.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
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, [
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
                 $property .= 'string';
44 44
                 break;
45 45
             default:
46
-                throw new Exception('Unknown Array items type "' . $this->field['items']['type'] . '"');
46
+                throw new Exception('Unknown Array items type "'.$this->field['items']['type'].'"');
47 47
         }
48 48
 
49
-        return $property . ' $' . $this->snakeId();
49
+        return $property.' $'.$this->snakeId();
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
Contentful/Commands/Generators/Definitions/IntegerDefinition.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 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' => $this->id(),
@@ -22,6 +22,6 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function modelProperty()
24 24
     {
25
-        return ' * @property int $' . $this->snakeId();
25
+        return ' * @property int $'.$this->snakeId();
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
Distilleries/Contentful/Commands/Generators/Definitions/LinkDefinition.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
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 Link items type "' . $this->field['linkType'] . '"');
22
+                throw new Exception('Unknown Link items type "'.$this->field['linkType'].'"');
23 23
         }
24 24
 
25 25
         return self::getStub($stubPath, [
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
                 $property .= '\Distilleries\Contentful\Models\Asset';
44 44
                 break;
45 45
             default:
46
-                throw new Exception('Unknown Link items type "' . $this->field['items']['type'] . '"');
46
+                throw new Exception('Unknown Link items type "'.$this->field['items']['type'].'"');
47 47
         }
48 48
 
49
-        return $property . ' $' . $this->snakeId();
49
+        return $property.' $'.$this->snakeId();
50 50
     }
51 51
 }
Please login to merge, or discard this patch.
Contentful/Commands/Generators/Definitions/RichTextDefinition.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
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' => $this->id(),
@@ -22,6 +22,6 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function modelProperty()
24 24
     {
25
-        return ' * @property string $' . $this->snakeId();
25
+        return ' * @property string $'.$this->snakeId();
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
Contentful/Commands/Generators/Definitions/BooleanDefinition.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 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' => $this->id(),
@@ -22,6 +22,6 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function modelProperty()
24 24
     {
25
-        return ' * @property bool $' . $this->snakeId();
25
+        return ' * @property bool $'.$this->snakeId();
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Commands/Generators/AbstractGenerator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function tableName($id)
40 40
     {
41
-        return DB::getTablePrefix() . Str::plural(Str::snake($id));
41
+        return DB::getTablePrefix().Str::plural(Str::snake($id));
42 42
     }
43 43
 
44 44
     /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     {
56 56
         $content = file_get_contents($stubPath);
57 57
         foreach ($replacements as $key => $value) {
58
-            $content = str_replace('{{' . Str::upper($key) . '}}', $value, $content);
58
+            $content = str_replace('{{'.Str::upper($key).'}}', $value, $content);
59 59
         }
60 60
 
61 61
         file_put_contents($destPath, $content);
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
             ]],
99 99
         ];
100 100
 
101
-        $assetContentType['fields'] = array_map(function ($field) {
102
-            if (! isset($field['required'])) {
101
+        $assetContentType['fields'] = array_map(function($field) {
102
+            if (!isset($field['required'])) {
103 103
                 $field['required'] = true;
104 104
             }
105 105
             $field['disabled'] = false;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      */
121 121
     protected function fieldDefinition($table, $field): ?DefinitionInterface
122 122
     {
123
-        $className = '\Distilleries\Contentful\Commands\Generators\Definitions\\' . $field['type'] . 'Definition';
123
+        $className = '\Distilleries\Contentful\Commands\Generators\Definitions\\'.$field['type'].'Definition';
124 124
 
125 125
         if (class_exists($className)) {
126 126
             return new $className($table, $field);
@@ -137,6 +137,6 @@  discard block
 block discarded – undo
137 137
      */
138 138
     protected function isFieldEnabled($field): bool
139 139
     {
140
-        return ! $field['disabled'] && ! $field['omitted'];
140
+        return !$field['disabled'] && !$field['omitted'];
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Commands/Generators/Models.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
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
 
33 33
             foreach ($contentTypes['items'] as $contentType) {
34 34
                 if ($contentType['sys']['id'] !== 'asset') {
35
-                    $this->info('Content-Type: ' . Str::upper($contentType['name']));
35
+                    $this->info('Content-Type: '.Str::upper($contentType['name']));
36 36
                     $file = $this->createMapper($contentType);
37
-                    $this->line('Mapper "' . $file . '" created');
37
+                    $this->line('Mapper "'.$file.'" created');
38 38
                     $file = $this->createModel($contentType);
39
-                    $this->line('Model "' . $file . '" created');
39
+                    $this->line('Model "'.$file.'" created');
40 40
                 }
41 41
             }
42 42
         }
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
         $table = $this->tableName($contentType['sys']['id']);
55 55
         $model = Str::studly(Str::singular($table));
56 56
 
57
-        $stubPath = __DIR__ . '/stubs/model.stub';
58
-        $destPath = rtrim(config('contentful.generator.model'), '/') . '/' . $model . '.php';
57
+        $stubPath = __DIR__.'/stubs/model.stub';
58
+        $destPath = rtrim(config('contentful.generator.model'), '/').'/'.$model.'.php';
59 59
 
60 60
         return static::writeStub($stubPath, $destPath, [
61 61
             'model' => $model,
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
         $table = $this->tableName($contentType['sys']['id']);
77 77
         $model = Str::studly(Str::singular($table));
78 78
 
79
-        $stubPath = __DIR__ . '/stubs/mapper.stub';
80
-        $destPath = rtrim(config('contentful.generator.mapper'), '/') . '/' . $model . 'Mapper.php';
79
+        $stubPath = __DIR__.'/stubs/mapper.stub';
80
+        $destPath = rtrim(config('contentful.generator.mapper'), '/').'/'.$model.'Mapper.php';
81 81
 
82 82
         return static::writeStub($stubPath, $destPath, [
83 83
             'model' => $model
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
             }
103 103
         }
104 104
 
105
-        $getters = rtrim(implode("\n", array_map(function ($getter) {
105
+        $getters = rtrim(implode("\n", array_map(function($getter) {
106 106
             return $getter;
107 107
         }, $getters)));
108 108
 
109
-        return ! empty($getters) ? "\n" . $getters : "\n\t\t//";
109
+        return !empty($getters) ? "\n".$getters : "\n\t\t//";
110 110
     }
111 111
 
112 112
     /**
@@ -127,6 +127,6 @@  discard block
 block discarded – undo
127 127
             }
128 128
         }
129 129
 
130
-        return ! empty($properties) ? "\n" . implode("\n", $properties) : '';
130
+        return !empty($properties) ? "\n".implode("\n", $properties) : '';
131 131
     }
132 132
 }
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Repositories/AssetsRepository.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $locales = [];
62 62
 
63
-        if (isset($asset['fields']) && ! empty($asset['fields'])) {
63
+        if (isset($asset['fields']) && !empty($asset['fields'])) {
64 64
             $firstField = Arr::first($asset['fields']);
65 65
             $locales = array_keys($firstField);
66 66
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         $country = Locale::getCountry($locale);
81 81
         $iso = Locale::getLocale($locale);
82 82
 
83
-        if (! Locale::canBeSave($country, $iso)) {
83
+        if (!Locale::canBeSave($country, $iso)) {
84 84
             return null;
85 85
         }
86 86
 
@@ -165,10 +165,8 @@  discard block
 block discarded – undo
165 165
      */
166 166
     protected function getFieldValue(array $fields, string $field, string $locale, string $fallbackLocale, $default, string $secondFallback = null)
167 167
     {
168
-        return ! empty($fields[$field][$locale]) ?
169
-            $fields[$field][$locale] :
170
-            (! empty($fields[$field][$fallbackLocale]) ? $fields[$field][$fallbackLocale] :
171
-                (! empty($secondFallback) && ! empty($fields[$field][$secondFallback]) ? $fields[$field][$secondFallback] : $default)
168
+        return !empty($fields[$field][$locale]) ?
169
+            $fields[$field][$locale] : (!empty($fields[$field][$fallbackLocale]) ? $fields[$field][$fallbackLocale] : (!empty($secondFallback) && !empty($fields[$field][$secondFallback]) ? $fields[$field][$secondFallback] : $default)
172 170
             );
173 171
     }
174 172
 }
Please login to merge, or discard this patch.