Completed
Pull Request — master (#34)
by Oyebanji Jacob
03:27
created
src/Mpociot/ApiDoc/Generators/AbstractGenerator.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $uri = $this->getUri($route);
78 78
         foreach ($bindings as $model => $id) {
79
-            $uri = str_replace('{'.$model.'}', $id, $uri);
79
+            $uri = str_replace('{' . $model . '}', $id, $uri);
80 80
         }
81 81
 
82 82
         return $uri;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         foreach ($reflectionMethod->getParameters() as $parameter) {
137 137
             $parameterType = $parameter->getClass();
138
-            if (is_null($parameterType) && ! class_exists($parameterType->name)) {
138
+            if (is_null($parameterType) && !class_exists($parameterType->name)) {
139 139
                 continue;
140 140
             }
141 141
             $className = $parameterType->name;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
      */
159 159
     protected function fancyImplode($arr, $first, $last)
160 160
     {
161
-        $arr = array_map(function ($value) {
162
-            return '`'.$value.'`';
161
+        $arr = array_map(function($value) {
162
+            return '`' . $value . '`';
163 163
         }, $arr);
164 164
         array_push($arr, implode($last, array_splice($arr, -2)));
165 165
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 break;
192 192
             case 'after':
193 193
                 $attributeData['type'] = 'date';
194
-                $attributeData['description'][] = 'Must be a date after: `'.date(DATE_RFC850, strtotime($parameters[0])).'`';
194
+                $attributeData['description'][] = 'Must be a date after: `' . date(DATE_RFC850, strtotime($parameters[0])) . '`';
195 195
                 $attributeData['value'] = date(DATE_RFC850, strtotime('+1 day', strtotime($parameters[0])));
196 196
                 break;
197 197
             case 'alpha':
@@ -209,40 +209,40 @@  discard block
 block discarded – undo
209 209
                 $attributeData['value'] = $faker->randomElement($parameters);
210 210
                 break;
211 211
             case 'not_in':
212
-                $attributeData['description'][] = 'Not in: '.$this->fancyImplode($parameters, ', ', ' or ');
212
+                $attributeData['description'][] = 'Not in: ' . $this->fancyImplode($parameters, ', ', ' or ');
213 213
                 $attributeData['value'] = $faker->word;
214 214
                 break;
215 215
             case 'min':
216
-                $attributeData['description'][] = 'Minimum: `'.$parameters[0].'`';
216
+                $attributeData['description'][] = 'Minimum: `' . $parameters[0] . '`';
217 217
                 break;
218 218
             case 'max':
219
-                $attributeData['description'][] = 'Maximum: `'.$parameters[0].'`';
219
+                $attributeData['description'][] = 'Maximum: `' . $parameters[0] . '`';
220 220
                 break;
221 221
             case 'between':
222 222
                 $attributeData['type'] = 'numeric';
223
-                $attributeData['description'][] = 'Between: `'.$parameters[0].'` and `'.$parameters[1].'`';
223
+                $attributeData['description'][] = 'Between: `' . $parameters[0] . '` and `' . $parameters[1] . '`';
224 224
                 $attributeData['value'] = $faker->numberBetween($parameters[0], $parameters[1]);
225 225
                 break;
226 226
             case 'before':
227 227
                 $attributeData['type'] = 'date';
228
-                $attributeData['description'][] = 'Must be a date preceding: `'.date(DATE_RFC850, strtotime($parameters[0])).'`';
228
+                $attributeData['description'][] = 'Must be a date preceding: `' . date(DATE_RFC850, strtotime($parameters[0])) . '`';
229 229
                 $attributeData['value'] = date(DATE_RFC850, strtotime('-1 day', strtotime($parameters[0])));
230 230
                 break;
231 231
             case 'date_format':
232 232
                 $attributeData['type'] = 'date';
233
-                $attributeData['description'][] = 'Date format: `'.$parameters[0].'`';
233
+                $attributeData['description'][] = 'Date format: `' . $parameters[0] . '`';
234 234
                 break;
235 235
             case 'different':
236
-                $attributeData['description'][] = 'Must have a different value than parameter: `'.$parameters[0].'`';
236
+                $attributeData['description'][] = 'Must have a different value than parameter: `' . $parameters[0] . '`';
237 237
                 break;
238 238
             case 'digits':
239 239
                 $attributeData['type'] = 'numeric';
240
-                $attributeData['description'][] = 'Must have an exact length of `'.$parameters[0].'`';
240
+                $attributeData['description'][] = 'Must have an exact length of `' . $parameters[0] . '`';
241 241
                 $attributeData['value'] = $faker->randomNumber($parameters[0], true);
242 242
                 break;
243 243
             case 'digits_between':
244 244
                 $attributeData['type'] = 'numeric';
245
-                $attributeData['description'][] = 'Must have a length between `'.$parameters[0].'` and `'.$parameters[1].'`';
245
+                $attributeData['description'][] = 'Must have a length between `' . $parameters[0] . '` and `' . $parameters[1] . '`';
246 246
                 break;
247 247
             case 'image':
248 248
                 $attributeData['type'] = 'image';
@@ -255,38 +255,38 @@  discard block
 block discarded – undo
255 255
                 break;
256 256
             case 'mimetypes':
257 257
             case 'mimes':
258
-                $attributeData['description'][] = 'Allowed mime types: '.$this->fancyImplode($parameters, ', ', ' or ');
258
+                $attributeData['description'][] = 'Allowed mime types: ' . $this->fancyImplode($parameters, ', ', ' or ');
259 259
                 break;
260 260
             case 'required_if':
261
-                $attributeData['description'][] = 'Required if `'.$parameters[0].'` is `'.$parameters[1].'`';
261
+                $attributeData['description'][] = 'Required if `' . $parameters[0] . '` is `' . $parameters[1] . '`';
262 262
                 break;
263 263
             case 'required_unless':
264
-                $attributeData['description'][] = 'Required unless `'.$parameters[0].'` is `'.$parameters[1].'`';
264
+                $attributeData['description'][] = 'Required unless `' . $parameters[0] . '` is `' . $parameters[1] . '`';
265 265
                 break;
266 266
             case 'required_with':
267
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' or ').' are present.';
267
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' or ') . ' are present.';
268 268
                 break;
269 269
             case 'required_with_all':
270
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' and ').' are present.';
270
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' and ') . ' are present.';
271 271
                 break;
272 272
             case 'required_without':
273
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' or ').' are not present.';
273
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' or ') . ' are not present.';
274 274
                 break;
275 275
             case 'required_without_all':
276
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' and ').' are not present.';
276
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' and ') . ' are not present.';
277 277
                 break;
278 278
             case 'same':
279
-                $attributeData['description'][] = 'Must be the same as `'.$parameters[0].'`';
279
+                $attributeData['description'][] = 'Must be the same as `' . $parameters[0] . '`';
280 280
                 break;
281 281
             case 'size':
282
-                $attributeData['description'][] = 'Must have the size of `'.$parameters[0].'`';
282
+                $attributeData['description'][] = 'Must have the size of `' . $parameters[0] . '`';
283 283
                 break;
284 284
             case 'timezone':
285 285
                 $attributeData['description'][] = 'Must be a valid timezone identifier';
286 286
                 $attributeData['value'] = $faker->timezone;
287 287
                 break;
288 288
             case 'exists':
289
-                $attributeData['description'][] = 'Valid '.Str::singular($parameters[0]).' '.$parameters[1];
289
+                $attributeData['description'][] = 'Valid ' . Str::singular($parameters[0]) . ' ' . $parameters[1];
290 290
                 break;
291 291
             case 'active_url':
292 292
                 $attributeData['type'] = 'url';
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
                 break;
295 295
             case 'regex':
296 296
                 $attributeData['type'] = 'string';
297
-                $attributeData['description'][] = 'Must match this regular expression: `'.$parameters[0].'`';
297
+                $attributeData['description'][] = 'Must match this regular expression: `' . $parameters[0] . '`';
298 298
                 break;
299 299
             case 'boolean':
300 300
                 $attributeData['value'] = true;
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
         foreach ($headers as $name => $value) {
370 370
             $name = strtr(strtoupper($name), '-', '_');
371 371
 
372
-            if (! Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
373
-                $name = $prefix.$name;
372
+            if (!Str::startsWith($name, $prefix) && $name !== 'CONTENT_TYPE') {
373
+                $name = $prefix . $name;
374 374
             }
375 375
 
376 376
             $server[$name] = $value;
Please login to merge, or discard this patch.