Completed
Pull Request — master (#21)
by Lucas
02:40
created
src/Mpociot/ApiDoc/ApiDocGenerator.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         foreach ($reflectionMethod->getParameters() as $parameter) {
104 104
             $parameterType = $parameter->getClass();
105
-            if (! is_null($parameterType) && class_exists($parameterType->name)) {
105
+            if (!is_null($parameterType) && class_exists($parameterType->name)) {
106 106
                 $className = $parameterType->name;
107 107
                 $parameterReflection = new $className;
108 108
                 if ($parameterReflection instanceof FormRequest) {
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
      */
128 128
     protected function fancyImplode($arr, $first, $last)
129 129
     {
130
-        $arr = array_map(function ($value) {
131
-            return '`'.$value.'`';
130
+        $arr = array_map(function($value) {
131
+            return '`' . $value . '`';
132 132
         }, $arr);
133 133
         array_push($arr, implode($last, array_splice($arr, -2)));
134 134
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 break;
161 161
             case 'after':
162 162
                 $attributeData['type'] = 'date';
163
-                $attributeData['description'][] = 'Must be a date after: `'.date(DATE_RFC850, strtotime($parameters[0])).'`';
163
+                $attributeData['description'][] = 'Must be a date after: `' . date(DATE_RFC850, strtotime($parameters[0])) . '`';
164 164
                 $attributeData['value'] = date(DATE_RFC850, strtotime('+1 day', strtotime($parameters[0])));
165 165
                 break;
166 166
             case 'alpha':
@@ -178,40 +178,40 @@  discard block
 block discarded – undo
178 178
                 $attributeData['value'] = $faker->randomElement($parameters);
179 179
                 break;
180 180
             case 'not_in':
181
-                $attributeData['description'][] = 'Not in: '.$this->fancyImplode($parameters, ', ', ' or ');
181
+                $attributeData['description'][] = 'Not in: ' . $this->fancyImplode($parameters, ', ', ' or ');
182 182
                 $attributeData['value'] = $faker->word;
183 183
                 break;
184 184
             case 'min':
185
-                $attributeData['description'][] = 'Minimum: `'.$parameters[0].'`';
185
+                $attributeData['description'][] = 'Minimum: `' . $parameters[0] . '`';
186 186
                 break;
187 187
             case 'max':
188
-                $attributeData['description'][] = 'Maximum: `'.$parameters[0].'`';
188
+                $attributeData['description'][] = 'Maximum: `' . $parameters[0] . '`';
189 189
                 break;
190 190
             case 'between':
191 191
                 $attributeData['type'] = 'numeric';
192
-                $attributeData['description'][] = 'Between: `'.$parameters[0].'` and `'.$parameters[1].'`';
192
+                $attributeData['description'][] = 'Between: `' . $parameters[0] . '` and `' . $parameters[1] . '`';
193 193
                 $attributeData['value'] = $faker->numberBetween($parameters[0], $parameters[1]);
194 194
                 break;
195 195
             case 'before':
196 196
                 $attributeData['type'] = 'date';
197
-                $attributeData['description'][] = 'Must be a date preceding: `'.date(DATE_RFC850, strtotime($parameters[0])).'`';
197
+                $attributeData['description'][] = 'Must be a date preceding: `' . date(DATE_RFC850, strtotime($parameters[0])) . '`';
198 198
                 $attributeData['value'] = date(DATE_RFC850, strtotime('-1 day', strtotime($parameters[0])));
199 199
                 break;
200 200
             case 'date_format':
201 201
                 $attributeData['type'] = 'date';
202
-                $attributeData['description'][] = 'Date format: `'.$parameters[0].'`';
202
+                $attributeData['description'][] = 'Date format: `' . $parameters[0] . '`';
203 203
                 break;
204 204
             case 'different':
205
-                $attributeData['description'][] = 'Must have a different value than parameter: `'.$parameters[0].'`';
205
+                $attributeData['description'][] = 'Must have a different value than parameter: `' . $parameters[0] . '`';
206 206
                 break;
207 207
             case 'digits':
208 208
                 $attributeData['type'] = 'numeric';
209
-                $attributeData['description'][] = 'Must have an exact length of `'.$parameters[0].'`';
209
+                $attributeData['description'][] = 'Must have an exact length of `' . $parameters[0] . '`';
210 210
                 $attributeData['value'] = $faker->randomNumber($parameters[0], true);
211 211
                 break;
212 212
             case 'digits_between':
213 213
                 $attributeData['type'] = 'numeric';
214
-                $attributeData['description'][] = 'Must have a length between `'.$parameters[0].'` and `'.$parameters[1].'`';
214
+                $attributeData['description'][] = 'Must have a length between `' . $parameters[0] . '` and `' . $parameters[1] . '`';
215 215
                 break;
216 216
             case 'image':
217 217
                 $attributeData['type'] = 'image';
@@ -224,38 +224,38 @@  discard block
 block discarded – undo
224 224
                 break;
225 225
             case 'mimetypes':
226 226
             case 'mimes':
227
-                $attributeData['description'][] = 'Allowed mime types: '.$this->fancyImplode($parameters, ', ', ' or ');
227
+                $attributeData['description'][] = 'Allowed mime types: ' . $this->fancyImplode($parameters, ', ', ' or ');
228 228
                 break;
229 229
             case 'required_if':
230
-                $attributeData['description'][] = 'Required if `'.$parameters[0].'` is `'.$parameters[1].'`';
230
+                $attributeData['description'][] = 'Required if `' . $parameters[0] . '` is `' . $parameters[1] . '`';
231 231
                 break;
232 232
             case 'required_unless':
233
-                $attributeData['description'][] = 'Required unless `'.$parameters[0].'` is `'.$parameters[1].'`';
233
+                $attributeData['description'][] = 'Required unless `' . $parameters[0] . '` is `' . $parameters[1] . '`';
234 234
                 break;
235 235
             case 'required_with':
236
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' or ').' are present.';
236
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' or ') . ' are present.';
237 237
                 break;
238 238
             case 'required_with_all':
239
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' and ').' are present.';
239
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' and ') . ' are present.';
240 240
                 break;
241 241
             case 'required_without':
242
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' or ').' are not present.';
242
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' or ') . ' are not present.';
243 243
                 break;
244 244
             case 'required_without_all':
245
-                $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' and ').' are not present.';
245
+                $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' and ') . ' are not present.';
246 246
                 break;
247 247
             case 'same':
248
-                $attributeData['description'][] = 'Must be the same as `'.$parameters[0].'`';
248
+                $attributeData['description'][] = 'Must be the same as `' . $parameters[0] . '`';
249 249
                 break;
250 250
             case 'size':
251
-                $attributeData['description'][] = 'Must have the size of `'.$parameters[0].'`';
251
+                $attributeData['description'][] = 'Must have the size of `' . $parameters[0] . '`';
252 252
                 break;
253 253
             case 'timezone':
254 254
                 $attributeData['description'][] = 'Must be a valid timezone identifier';
255 255
                 $attributeData['value'] = $faker->timezone;
256 256
                 break;
257 257
             case 'exists':
258
-                $attributeData['description'][] = 'Valid '.Str::singular($parameters[0]).' '.$parameters[1];
258
+                $attributeData['description'][] = 'Valid ' . Str::singular($parameters[0]) . ' ' . $parameters[1];
259 259
                 break;
260 260
             case 'active_url':
261 261
                 $attributeData['type'] = 'url';
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                 break;
264 264
             case 'regex':
265 265
                 $attributeData['type'] = 'string';
266
-                $attributeData['description'][] = 'Must match this regular expression: `'.$parameters[0].'`';
266
+                $attributeData['description'][] = 'Must match this regular expression: `' . $parameters[0] . '`';
267 267
                 break;
268 268
             case 'boolean':
269 269
                 $attributeData['value'] = true;
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
         foreach ($headers as $name => $value) {
359 359
             $name = strtr(strtoupper($name), '-', '_');
360 360
 
361
-            if (! starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
362
-                $name = $prefix.$name;
361
+            if (!starts_with($name, $prefix) && $name !== 'CONTENT_TYPE') {
362
+                $name = $prefix . $name;
363 363
             }
364 364
 
365 365
             $server[$name] = $value;
Please login to merge, or discard this patch.