@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | |
110 | 110 | /** |
111 | 111 | * @param $arr |
112 | - * @param $first |
|
113 | - * @param $last |
|
112 | + * @param string $first |
|
113 | + * @param string $last |
|
114 | 114 | * @return string |
115 | 115 | */ |
116 | 116 | protected function fancyImplode($arr, $first, $last) |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @param string $rule |
337 | 337 | * @param string $parameter |
338 | - * @return array |
|
338 | + * @return string |
|
339 | 339 | */ |
340 | 340 | protected function parseParameters($rule, $parameter) |
341 | 341 | { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | foreach ($reflectionMethod->getParameters() as $parameter) { |
99 | 99 | $parameterType = $parameter->getClass(); |
100 | - if (! is_null($parameterType) && class_exists($parameterType->name)) { |
|
100 | + if (!is_null($parameterType) && class_exists($parameterType->name)) { |
|
101 | 101 | $className = $parameterType->name; |
102 | 102 | $parameterReflection = new $className; |
103 | 103 | if ($parameterReflection instanceof FormRequest) { |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function fancyImplode($arr, $first, $last) |
124 | 124 | { |
125 | - $arr = array_map(function ($value) { |
|
126 | - return '`'.$value.'`'; |
|
125 | + $arr = array_map(function($value) { |
|
126 | + return '`' . $value . '`'; |
|
127 | 127 | }, $arr); |
128 | 128 | array_push($arr, implode($last, array_splice($arr, -2))); |
129 | 129 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | break; |
154 | 154 | case 'after': |
155 | 155 | $attributeData['type'] = 'date'; |
156 | - $attributeData['description'][] = 'Must be a date after: `'.date(DATE_RFC850, strtotime($parameters[0])).'`'; |
|
156 | + $attributeData['description'][] = 'Must be a date after: `' . date(DATE_RFC850, strtotime($parameters[0])) . '`'; |
|
157 | 157 | $attributeData['value'] = date(DATE_RFC850, strtotime('+1 day', strtotime($parameters[0]))); |
158 | 158 | break; |
159 | 159 | case 'alpha': |
@@ -171,40 +171,40 @@ discard block |
||
171 | 171 | $attributeData['value'] = $faker->randomElement($parameters); |
172 | 172 | break; |
173 | 173 | case 'not_in': |
174 | - $attributeData['description'][] = 'Not in: '.$this->fancyImplode($parameters, ', ', ' or '); |
|
174 | + $attributeData['description'][] = 'Not in: ' . $this->fancyImplode($parameters, ', ', ' or '); |
|
175 | 175 | $attributeData['value'] = $faker->word; |
176 | 176 | break; |
177 | 177 | case 'min': |
178 | - $attributeData['description'][] = 'Minimum: `'.$parameters[0].'`'; |
|
178 | + $attributeData['description'][] = 'Minimum: `' . $parameters[0] . '`'; |
|
179 | 179 | break; |
180 | 180 | case 'max': |
181 | - $attributeData['description'][] = 'Maximum: `'.$parameters[0].'`'; |
|
181 | + $attributeData['description'][] = 'Maximum: `' . $parameters[0] . '`'; |
|
182 | 182 | break; |
183 | 183 | case 'between': |
184 | 184 | $attributeData['type'] = 'numeric'; |
185 | - $attributeData['description'][] = 'Between: `'.$parameters[0].'` and `'.$parameters[1].'`'; |
|
185 | + $attributeData['description'][] = 'Between: `' . $parameters[0] . '` and `' . $parameters[1] . '`'; |
|
186 | 186 | $attributeData['value'] = $faker->numberBetween($parameters[0], $parameters[1]); |
187 | 187 | break; |
188 | 188 | case 'before': |
189 | 189 | $attributeData['type'] = 'date'; |
190 | - $attributeData['description'][] = 'Must be a date preceding: `'.date(DATE_RFC850, strtotime($parameters[0])).'`'; |
|
190 | + $attributeData['description'][] = 'Must be a date preceding: `' . date(DATE_RFC850, strtotime($parameters[0])) . '`'; |
|
191 | 191 | $attributeData['value'] = date(DATE_RFC850, strtotime('-1 day', strtotime($parameters[0]))); |
192 | 192 | break; |
193 | 193 | case 'date_format': |
194 | 194 | $attributeData['type'] = 'date'; |
195 | - $attributeData['description'][] = 'Date format: `'.$parameters[0].'`'; |
|
195 | + $attributeData['description'][] = 'Date format: `' . $parameters[0] . '`'; |
|
196 | 196 | break; |
197 | 197 | case 'different': |
198 | - $attributeData['description'][] = 'Must have a different value than parameter: `'.$parameters[0].'`'; |
|
198 | + $attributeData['description'][] = 'Must have a different value than parameter: `' . $parameters[0] . '`'; |
|
199 | 199 | break; |
200 | 200 | case 'digits': |
201 | 201 | $attributeData['type'] = 'numeric'; |
202 | - $attributeData['description'][] = 'Must have an exact length of `'.$parameters[0].'`'; |
|
202 | + $attributeData['description'][] = 'Must have an exact length of `' . $parameters[0] . '`'; |
|
203 | 203 | $attributeData['value'] = $faker->randomNumber($parameters[0], true); |
204 | 204 | break; |
205 | 205 | case 'digits_between': |
206 | 206 | $attributeData['type'] = 'numeric'; |
207 | - $attributeData['description'][] = 'Must have a length between `'.$parameters[0].'` and `'.$parameters[1].'`'; |
|
207 | + $attributeData['description'][] = 'Must have a length between `' . $parameters[0] . '` and `' . $parameters[1] . '`'; |
|
208 | 208 | break; |
209 | 209 | case 'image': |
210 | 210 | $attributeData['type'] = 'image'; |
@@ -217,38 +217,38 @@ discard block |
||
217 | 217 | break; |
218 | 218 | case 'mimetypes': |
219 | 219 | case 'mimes': |
220 | - $attributeData['description'][] = 'Allowed mime types: '.$this->fancyImplode($parameters, ', ', ' or '); |
|
220 | + $attributeData['description'][] = 'Allowed mime types: ' . $this->fancyImplode($parameters, ', ', ' or '); |
|
221 | 221 | break; |
222 | 222 | case 'required_if': |
223 | - $attributeData['description'][] = 'Required if `'.$parameters[0].'` is `'.$parameters[1].'`'; |
|
223 | + $attributeData['description'][] = 'Required if `' . $parameters[0] . '` is `' . $parameters[1] . '`'; |
|
224 | 224 | break; |
225 | 225 | case 'required_unless': |
226 | - $attributeData['description'][] = 'Required unless `'.$parameters[0].'` is `'.$parameters[1].'`'; |
|
226 | + $attributeData['description'][] = 'Required unless `' . $parameters[0] . '` is `' . $parameters[1] . '`'; |
|
227 | 227 | break; |
228 | 228 | case 'required_with': |
229 | - $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' or ').' are present.'; |
|
229 | + $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' or ') . ' are present.'; |
|
230 | 230 | break; |
231 | 231 | case 'required_with_all': |
232 | - $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' and ').' are present.'; |
|
232 | + $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' and ') . ' are present.'; |
|
233 | 233 | break; |
234 | 234 | case 'required_without': |
235 | - $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' or ').' are not present.'; |
|
235 | + $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' or ') . ' are not present.'; |
|
236 | 236 | break; |
237 | 237 | case 'required_without_all': |
238 | - $attributeData['description'][] = 'Required if the parameters '.$this->fancyImplode($parameters, ', ', ' and ').' are not present.'; |
|
238 | + $attributeData['description'][] = 'Required if the parameters ' . $this->fancyImplode($parameters, ', ', ' and ') . ' are not present.'; |
|
239 | 239 | break; |
240 | 240 | case 'same': |
241 | - $attributeData['description'][] = 'Must be the same as `'.$parameters[0].'`'; |
|
241 | + $attributeData['description'][] = 'Must be the same as `' . $parameters[0] . '`'; |
|
242 | 242 | break; |
243 | 243 | case 'size': |
244 | - $attributeData['description'][] = 'Must have the size of `'.$parameters[0].'`'; |
|
244 | + $attributeData['description'][] = 'Must have the size of `' . $parameters[0] . '`'; |
|
245 | 245 | break; |
246 | 246 | case 'timezone': |
247 | 247 | $attributeData['description'][] = 'Must be a valid timezone identifier'; |
248 | 248 | $attributeData['value'] = $faker->timezone; |
249 | 249 | break; |
250 | 250 | case 'exists': |
251 | - $attributeData['description'][] = 'Valid '.Str::singular($parameters[0]).' '.$parameters[1]; |
|
251 | + $attributeData['description'][] = 'Valid ' . Str::singular($parameters[0]) . ' ' . $parameters[1]; |
|
252 | 252 | break; |
253 | 253 | case 'active_url': |
254 | 254 | $attributeData['type'] = 'url'; |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | break; |
257 | 257 | case 'regex': |
258 | 258 | $attributeData['type'] = 'string'; |
259 | - $attributeData['description'][] = 'Must match this regular expression: `'.$parameters[0].'`'; |
|
259 | + $attributeData['description'][] = 'Must match this regular expression: `' . $parameters[0] . '`'; |
|
260 | 260 | break; |
261 | 261 | case 'boolean': |
262 | 262 | $attributeData['value'] = true; |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | foreach ($headers as $name => $value) { |
352 | 352 | $name = strtr(strtoupper($name), '-', '_'); |
353 | 353 | |
354 | - if (! starts_with($name, $prefix) && $name != 'CONTENT_TYPE') { |
|
355 | - $name = $prefix.$name; |
|
354 | + if (!starts_with($name, $prefix) && $name != 'CONTENT_TYPE') { |
|
355 | + $name = $prefix . $name; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | $server[$name] = $value; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | /** |
49 | 49 | * Execute the console command. |
50 | 50 | * |
51 | - * @return mixed |
|
51 | + * @return false|null |
|
52 | 52 | */ |
53 | 53 | public function handle() |
54 | 54 | { |
@@ -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 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | /** |
49 | 49 | * Execute the console command. |
50 | 50 | * |
51 | - * @return mixed |
|
51 | + * @return false|null |
|
52 | 52 | */ |
53 | 53 | public function handle() |
54 | 54 | { |
@@ -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 | } |
@@ -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 |