Completed
Pull Request — master (#34)
by Oyebanji Jacob
03:27
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/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/Commands/GenerateDocumentation.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         $this->setUserToBeImpersonated($this->option('actAsUserId'));
63 63
 
64
-        if ($routePrefix === null && ! count($allowedRoutes)) {
64
+        if ($routePrefix === null && !count($allowedRoutes)) {
65 65
             $this->error('You must provide either a route prefix or a route to generate the documentation.');
66 66
 
67 67
             return false;
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 
91 91
         $markdown = view('apidoc::documentarian')->with('parsedRoutes', $parsedRoutes->all());
92 92
 
93
-        if (! is_dir($outputPath)) {
93
+        if (!is_dir($outputPath)) {
94 94
             $documentarian->create($outputPath);
95 95
         }
96 96
 
97
-        file_put_contents($outputPath.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR.'index.md', $markdown);
97
+        file_put_contents($outputPath . DIRECTORY_SEPARATOR . 'source' . DIRECTORY_SEPARATOR . 'index.md', $markdown);
98 98
 
99
-        $this->info('Wrote index.md to: '.$outputPath);
99
+        $this->info('Wrote index.md to: ' . $outputPath);
100 100
 
101 101
         $this->info('Generating API HTML code');
102 102
 
103 103
         $documentarian->generate($outputPath);
104 104
 
105
-        $this->info('Wrote HTML documentation to: '.$outputPath.'/public/index.html');
105
+        $this->info('Wrote HTML documentation to: ' . $outputPath . '/public/index.html');
106 106
     }
107 107
 
108 108
     /**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     private function setUserToBeImpersonated($actAs)
131 131
     {
132
-        if (! empty($actAs)) {
132
+        if (!empty($actAs)) {
133 133
             if (version_compare($this->laravel->version(), '5.2.0', '<')) {
134 134
                 $userModel = config('auth.model');
135 135
                 $user = $userModel::find($actAs);
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
             if (in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->getUri())) {
171 171
                 if ($this->isValidRoute($route)) {
172 172
                     $parsedRoutes[] = $generator->processRoute($route, $bindings);
173
-                    $this->info('Processed route: '.$route->getUri());
173
+                    $this->info('Processed route: ' . $route->getUri());
174 174
                 } else {
175
-                    $this->warn('Skipping route: '.$route->getUri().' - contains closure.');
175
+                    $this->warn('Skipping route: ' . $route->getUri() . ' - contains closure.');
176 176
                 }
177 177
             }
178 178
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
         foreach ($routes as $route) {
196 196
             if (empty($allowedRoutes) || in_array($route->getName(), $allowedRoutes) || str_is($routePrefix, $route->uri())) {
197 197
                 $parsedRoutes[] = $generator->processRoute($route, $bindings);
198
-                $this->info('Processed route: '.$route->uri());
198
+                $this->info('Processed route: ' . $route->uri());
199 199
             }
200 200
         }
201 201
 
@@ -209,6 +209,6 @@  discard block
 block discarded – undo
209 209
      */
210 210
     private function isValidRoute($route)
211 211
     {
212
-        return ! is_callable($route->getAction()['uses']);
212
+        return !is_callable($route->getAction()['uses']);
213 213
     }
214 214
 }
Please login to merge, or discard this patch.
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.