Completed
Pull Request — master (#21)
by Lucas
02:40
created
src/Mpociot/ApiDoc/ApiDocGeneratorServiceProvider.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public function boot()
18 18
     {
19
-        $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'apidoc');
19
+        $this->loadViewsFrom(__DIR__ . '/../../resources/views/', 'apidoc');
20 20
     }
21 21
 
22 22
     /**
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function register()
26 26
     {
27
-        $this->app['apidoc.generate'] = $this->app->share(function () {
27
+        $this->app['apidoc.generate'] = $this->app->share(function() {
28 28
             return new GenerateDocumentation();
29 29
         });
30
-        $this->app['apidoc.update'] = $this->app->share(function () {
30
+        $this->app['apidoc.update'] = $this->app->share(function() {
31 31
             return new UpdateDocumentation();
32 32
         });
33 33
 
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Commands/GenerateDocumentation.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $routePrefix = $this->option('routePrefix');
51 51
         $actAs = $this->option('actAsUserId');
52 52
 
53
-        if ($routePrefix === null && ! count($allowedRoutes)) {
53
+        if ($routePrefix === null && !count($allowedRoutes)) {
54 54
             $this->error('You must provide either a route prefix or a route to generate the documentation.');
55 55
 
56 56
             return false;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         foreach ($routes as $route) {
76 76
             if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) {
77 77
                 $parsedRoutes[] = $generator->processRoute($route);
78
-                $this->info('Processed route: '.$route->getUri());
78
+                $this->info('Processed route: ' . $route->getUri());
79 79
             }
80 80
         }
81 81
 
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
 
94 94
         $markdown = view('apidoc::documentarian')->with('parsedRoutes', $parsedRoutes);
95 95
 
96
-        if (! is_dir($outputPath)) {
96
+        if (!is_dir($outputPath)) {
97 97
             $documentarian->create($outputPath);
98 98
         }
99 99
 
100
-        file_put_contents($outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md', $markdown);
100
+        file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md', $markdown);
101 101
 
102
-        $this->info('Wrote index.md to: '.$outputPath);
102
+        $this->info('Wrote index.md to: ' . $outputPath);
103 103
 
104 104
         $this->info('Generating API HTML code');
105 105
 
106 106
         $documentarian->generate($outputPath);
107 107
 
108
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
108
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
109 109
     }
110 110
 }
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/Commands/UpdateDocumentation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 
45 45
         $documentarian = new Documentarian();
46 46
 
47
-        if (! is_dir($outputPath)) {
48
-            $this->error('There is no generated documentation available at '.$outputPath.'.');
47
+        if (!is_dir($outputPath)) {
48
+            $this->error('There is no generated documentation available at ' . $outputPath . '.');
49 49
 
50 50
             return false;
51 51
         }
@@ -53,6 +53,6 @@  discard block
 block discarded – undo
53 53
 
54 54
         $documentarian->generate($outputPath);
55 55
 
56
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
56
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
57 57
     }
58 58
 }
Please login to merge, or discard this patch.
src/Mpociot/ApiDoc/ApiDocGenerator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -390,7 +390,7 @@
 block discarded – undo
390 390
      * @param  string $rule
391 391
      * @param  string $parameter
392 392
      *
393
-     * @return array
393
+     * @return string
394 394
      */
395 395
     protected function parseParameters($rule, $parameter)
396 396
     {
Please login to merge, or discard this 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.