Completed
Push — master ( a04585...ae1ab5 )
by Maxime
03:26
created
src/Distilleries/Contentful/Repositories/EntriesRepository.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $modelPath = config('contentful.generator.model');
26 26
 
27
-        foreach (glob($modelPath . '/*.php') as $file) {
27
+        foreach (glob($modelPath.'/*.php') as $file) {
28 28
             $modelInstance = NamespaceResolver::model(str_replace(
29 29
                 [$modelPath, '.php', '/'],
30 30
                 ['', '', '\\'],
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
      */
111 111
     private function entryMapper(array $entry): ContentfulMapper
112 112
     {
113
-        $class = studly_case($this->entryContentType($entry)) . 'Mapper';
113
+        $class = studly_case($this->entryContentType($entry)).'Mapper';
114 114
         $mapperClass = NamespaceResolver::mapper($class);
115 115
 
116 116
         if (empty($mapperClass) && !($mapperClass instanceof ContentfulMapper)) {
117
-            throw new Exception('Unknown mapper: ' . $class);
117
+            throw new Exception('Unknown mapper: '.$class);
118 118
         }
119 119
 
120 120
         return new $mapperClass;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         $modelClass = NamespaceResolver::modelClass($model);
134 134
 
135 135
         if (empty($modelClass)) {
136
-            throw new Exception('Unknown model: ' . $model);
136
+            throw new Exception('Unknown model: '.$model);
137 137
         }
138 138
 
139 139
         return new $modelClass;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $order = 1;
172 172
         foreach ($relationships as $relationship) {
173 173
             if (!isset($relationship['id']) || !isset($relationship['type'])) {
174
-                throw new Exception('Relationships malformed! (' . print_r($relationship, true) . ')');
174
+                throw new Exception('Relationships malformed! ('.print_r($relationship, true).')');
175 175
             }
176 176
 
177 177
             DB::table('entry_relationships')->insert([
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         }
231 231
 
232 232
         if (!isset($data['payload'])) {
233
-            throw new Exception('Mapper for model ' . class_basename($model) . ' must set a "payload" key');
233
+            throw new Exception('Mapper for model '.class_basename($model).' must set a "payload" key');
234 234
         }
235 235
 
236 236
         $instance = $this->instanceQueryBuilder($model, $data)->first();
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Helpers/NamspaceResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
         if (!empty($class)) {
28 28
             $model = new $class;
29
-            return $model instanceof ContentfulModel?$model:null;
29
+            return $model instanceof ContentfulModel ? $model : null;
30 30
         }
31 31
 
32 32
         return null;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         foreach (config($key, []) as $namespace) {
56 56
             $modelClass = rtrim($namespace,
57
-                    '\\') . '\\' . ltrim(studly_case($element), '\\');
57
+                    '\\').'\\'.ltrim(studly_case($element), '\\');
58 58
 
59 59
             if (class_exists($modelClass)) {
60 60
                 return $modelClass;
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Base/ContentfulModel.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -199,7 +199,7 @@
 block discarded – undo
199 199
      *
200 200
      * @param  array|string|null $link
201 201
      * @param  mixed $query
202
-     * @param  mixed $field
202
+     * @param  string $field
203 203
      * @return \Distilleries\Contentful\Models\Base\ContentfulModel|null
204 204
      */
205 205
     protected function contentfulEntry($link, $query = null, $field = null): ?ContentfulModel
Please login to merge, or discard this patch.
src/Distilleries/Contentful/Models/Base/ContentfulMapper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             if (is_array($value)) {
134 134
                 if ($this->isLink($value)) {
135 135
                     try {
136
-                        $relationships[] = $this->relationshipSignature($value,$field);
136
+                        $relationships[] = $this->relationshipSignature($value, $field);
137 137
                     } catch (Exception $e) {
138 138
                         //
139 139
                     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                     foreach ($value as $entry) {
142 142
                         if ($this->isLink($entry)) {
143 143
                             try {
144
-                                $relationships[] = $this->relationshipSignature($entry,$field);
144
+                                $relationships[] = $this->relationshipSignature($entry, $field);
145 145
                             } catch (Exception $e) {
146 146
                                 //
147 147
                             }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @return array|null
162 162
      * @throws \Exception
163 163
      */
164
-    private function relationshipSignature(array $localeField,string $field=''): ?array
164
+    private function relationshipSignature(array $localeField, string $field = ''): ?array
165 165
     {
166 166
         if ($localeField['sys']['linkType'] === 'Asset') {
167 167
             return [
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
             }
180 180
         }
181 181
 
182
-        throw new Exception('Invalid field signature... ' . PHP_EOL . print_r($localeField, true));
182
+        throw new Exception('Invalid field signature... '.PHP_EOL.print_r($localeField, true));
183 183
     }
184 184
 
185 185
     /**
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                     return $entry['sys']['contentType']['sys']['id'];
222 222
                 }
223 223
             } catch (Exception $e) {
224
-                throw new Exception('Unknown content-type from synced entry: ' . $contentfulId);
224
+                throw new Exception('Unknown content-type from synced entry: '.$contentfulId);
225 225
             }
226 226
         }
227 227
 
Please login to merge, or discard this patch.