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