@@ -14,7 +14,7 @@ |
||
14 | 14 | public function boot() |
15 | 15 | { |
16 | 16 | // Load routes, views, migrations, etc. |
17 | - $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); |
|
17 | + $this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); |
|
18 | 18 | |
19 | 19 | // If the package provides any views |
20 | 20 | // $this->loadViewsFrom(__DIR__.'/../resources/views', 'yourpackage'); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | /* |
13 | 13 | * Static output folder: HTML documentation and assets will be generated in this folder. |
14 | 14 | */ |
15 | - 'output_folder' => 'public/docs', |
|
15 | + 'output_folder' => 'public/docs', |
|
16 | 16 | |
17 | 17 | /* |
18 | 18 | * Settings for `laravel` type output. |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | parent::setUp(); |
26 | 26 | |
27 | 27 | $factory = app(\Illuminate\Database\Eloquent\Factory::class); |
28 | - $factory->define(TestUser::class, function () { |
|
28 | + $factory->define(TestUser::class, function() { |
|
29 | 29 | return [ |
30 | 30 | 'id' => 4, |
31 | 31 | 'first_name' => 'Tested', |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** @test */ |
57 | 57 | public function console_command_does_not_work_with_closure() |
58 | 58 | { |
59 | - RouteFacade::get('/api/closure', function () { |
|
59 | + RouteFacade::get('/api/closure', function() { |
|
60 | 60 | return 'hi'; |
61 | 61 | }); |
62 | 62 | RouteFacade::get('/api/test', TestController::class . '@withEndpointDescription'); |
@@ -214,9 +214,9 @@ |
||
214 | 214 | |
215 | 215 | $this->assertArraySubset([ |
216 | 216 | [ |
217 | - 'first_name' => 'John', |
|
218 | - 'last_name' => 'Doe', |
|
219 | - 'contacts' => [ |
|
217 | + 'first_name' => 'John', |
|
218 | + 'last_name' => 'Doe', |
|
219 | + 'contacts' => [ |
|
220 | 220 | [ |
221 | 221 | 'first_name' => 'John', |
222 | 222 | 'last_name' => 'Doe', |
@@ -66,7 +66,7 @@ |
||
66 | 66 | parent::setUp(); |
67 | 67 | |
68 | 68 | $factory = app(\Illuminate\Database\Eloquent\Factory::class); |
69 | - $factory->define(TestUser::class, function () { |
|
69 | + $factory->define(TestUser::class, function() { |
|
70 | 70 | return [ |
71 | 71 | 'id' => 4, |
72 | 72 | 'first_name' => 'Tested', |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $route = null; |
32 | 32 | /** @var Router $api */ |
33 | 33 | $api = app(Router::class); |
34 | - $api->version('v1', function (Router $api) use ($class, $controllerMethod, $path, $httpMethod, &$route) { |
|
34 | + $api->version('v1', function(Router $api) use ($class, $controllerMethod, $path, $httpMethod, &$route) { |
|
35 | 35 | $route = $api->$httpMethod($path, $class . "@$controllerMethod"); |
36 | 36 | }); |
37 | 37 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $route = null; |
44 | 44 | /** @var Router $api */ |
45 | 45 | $api = app(Router::class); |
46 | - $api->version('v1', function (Router $api) use ($class, $controllerMethod, $path, $httpMethod, &$route) { |
|
46 | + $api->version('v1', function(Router $api) use ($class, $controllerMethod, $path, $httpMethod, &$route) { |
|
47 | 47 | $route = $api->$httpMethod($path, [$class, $controllerMethod]); |
48 | 48 | }); |
49 | 49 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ]; |
125 | 125 | $matcher = new RouteMatcher(); |
126 | 126 | $routes = $matcher->getRoutes($routeRules, 'dingo'); |
127 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustInclude) { |
|
127 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustInclude) { |
|
128 | 128 | return $route['route']->getName() === $mustInclude; |
129 | 129 | }); |
130 | 130 | $this->assertCount(1, $oddRuleOut); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | ]; |
149 | 149 | $matcher = new RouteMatcher(); |
150 | 150 | $routes = $matcher->getRoutes($routeRules, 'dingo'); |
151 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustInclude) { |
|
151 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustInclude) { |
|
152 | 152 | return in_array($route['route']->getName(), $mustInclude); |
153 | 153 | }); |
154 | 154 | $this->assertCount(count($mustInclude), $oddRuleOut); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | ]; |
172 | 172 | $matcher = new RouteMatcher(); |
173 | 173 | $routes = $matcher->getRoutes($routeRules, 'dingo'); |
174 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustNotInclude) { |
|
174 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustNotInclude) { |
|
175 | 175 | return $route['route']->getName() === $mustNotInclude; |
176 | 176 | }); |
177 | 177 | $this->assertCount(0, $oddRuleOut); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ]; |
196 | 196 | $matcher = new RouteMatcher(); |
197 | 197 | $routes = $matcher->getRoutes($routeRules, 'dingo'); |
198 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustNotInclude) { |
|
198 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustNotInclude) { |
|
199 | 199 | return in_array($route['route']->getName(), $mustNotInclude); |
200 | 200 | }); |
201 | 201 | $this->assertCount(0, $oddRuleOut); |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | $this->assertCount(18, $routes); |
227 | 227 | |
228 | 228 | $routes = collect($routes); |
229 | - $firstRuleGroup = $routes->filter(function ($route) { |
|
230 | - return ! empty(array_intersect($route['route']->versions(), ['v1'])); |
|
229 | + $firstRuleGroup = $routes->filter(function($route) { |
|
230 | + return !empty(array_intersect($route['route']->versions(), ['v1'])); |
|
231 | 231 | }); |
232 | 232 | $this->assertCount(12, $firstRuleGroup); |
233 | 233 | |
234 | - $secondRuleGroup = $routes->filter(function ($route) { |
|
235 | - return ! empty(array_intersect($route['route']->versions(), ['v2'])); |
|
234 | + $secondRuleGroup = $routes->filter(function($route) { |
|
235 | + return !empty(array_intersect($route['route']->versions(), ['v2'])); |
|
236 | 236 | }); |
237 | 237 | $this->assertCount(6, $secondRuleGroup); |
238 | 238 | } |
@@ -240,68 +240,68 @@ discard block |
||
240 | 240 | private function registerDingoRoutes() |
241 | 241 | { |
242 | 242 | $api = app('api.router'); |
243 | - $api->version('v1', function (Router $api) { |
|
244 | - $api->group(['domain' => 'domain1.app.test'], function (Router $api) { |
|
245 | - $api->post('/domain1-1', function () { |
|
243 | + $api->version('v1', function(Router $api) { |
|
244 | + $api->group(['domain' => 'domain1.app.test'], function(Router $api) { |
|
245 | + $api->post('/domain1-1', function() { |
|
246 | 246 | return 'hi'; |
247 | 247 | })->name('v1.domain1-1'); |
248 | - $api->get('domain1-2', function () { |
|
248 | + $api->get('domain1-2', function() { |
|
249 | 249 | return 'hi'; |
250 | 250 | })->name('v1.domain1-2'); |
251 | - $api->get('/prefix1/domain1-1', function () { |
|
251 | + $api->get('/prefix1/domain1-1', function() { |
|
252 | 252 | return 'hi'; |
253 | 253 | })->name('v1.prefix1.domain1-1'); |
254 | - $api->get('prefix1/domain1-2', function () { |
|
254 | + $api->get('prefix1/domain1-2', function() { |
|
255 | 255 | return 'hi'; |
256 | 256 | })->name('v1.prefix1.domain1-2'); |
257 | - $api->get('/prefix2/domain1-1', function () { |
|
257 | + $api->get('/prefix2/domain1-1', function() { |
|
258 | 258 | return 'hi'; |
259 | 259 | })->name('v1.prefix2.domain1-1'); |
260 | - $api->get('prefix2/domain1-2', function () { |
|
260 | + $api->get('prefix2/domain1-2', function() { |
|
261 | 261 | return 'hi'; |
262 | 262 | })->name('v1.prefix2.domain1-2'); |
263 | 263 | }); |
264 | - $api->group(['domain' => 'domain2.app.test'], function (Router $api) { |
|
265 | - $api->post('/domain2-1', function () { |
|
264 | + $api->group(['domain' => 'domain2.app.test'], function(Router $api) { |
|
265 | + $api->post('/domain2-1', function() { |
|
266 | 266 | return 'hi'; |
267 | 267 | })->name('v1.domain2-1'); |
268 | - $api->get('domain2-2', function () { |
|
268 | + $api->get('domain2-2', function() { |
|
269 | 269 | return 'hi'; |
270 | 270 | })->name('v1.domain2-2'); |
271 | - $api->get('/prefix1/domain2-1', function () { |
|
271 | + $api->get('/prefix1/domain2-1', function() { |
|
272 | 272 | return 'hi'; |
273 | 273 | })->name('v1.prefix1.domain2-1'); |
274 | - $api->get('prefix1/domain2-2', function () { |
|
274 | + $api->get('prefix1/domain2-2', function() { |
|
275 | 275 | return 'hi'; |
276 | 276 | })->name('v1.prefix1.domain2-2'); |
277 | - $api->get('/prefix2/domain2-1', function () { |
|
277 | + $api->get('/prefix2/domain2-1', function() { |
|
278 | 278 | return 'hi'; |
279 | 279 | })->name('v1.prefix2.domain2-1'); |
280 | - $api->get('prefix2/domain2-2', function () { |
|
280 | + $api->get('prefix2/domain2-2', function() { |
|
281 | 281 | return 'hi'; |
282 | 282 | })->name('v1.prefix2.domain2-2'); |
283 | 283 | }); |
284 | 284 | }); |
285 | - $api->version('v2', function (Router $api) { |
|
286 | - $api->group(['domain' => 'domain1.app.test'], function (Router $api) { |
|
287 | - $api->post('/domain1', function () { |
|
285 | + $api->version('v2', function(Router $api) { |
|
286 | + $api->group(['domain' => 'domain1.app.test'], function(Router $api) { |
|
287 | + $api->post('/domain1', function() { |
|
288 | 288 | return 'hi'; |
289 | 289 | })->name('v2.domain1'); |
290 | - $api->get('/prefix1/domain1', function () { |
|
290 | + $api->get('/prefix1/domain1', function() { |
|
291 | 291 | return 'hi'; |
292 | 292 | })->name('v2.prefix1.domain1'); |
293 | - $api->get('/prefix2/domain1', function () { |
|
293 | + $api->get('/prefix2/domain1', function() { |
|
294 | 294 | return 'hi'; |
295 | 295 | })->name('v2.prefix2.domain1'); |
296 | 296 | }); |
297 | - $api->group(['domain' => 'domain2.app.test'], function (Router $api) { |
|
298 | - $api->post('/domain2', function () { |
|
297 | + $api->group(['domain' => 'domain2.app.test'], function(Router $api) { |
|
298 | + $api->post('/domain2', function() { |
|
299 | 299 | return 'hi'; |
300 | 300 | })->name('v2.domain2'); |
301 | - $api->get('/prefix1/domain2', function () { |
|
301 | + $api->get('/prefix1/domain2', function() { |
|
302 | 302 | return 'hi'; |
303 | 303 | })->name('v2.prefix1.domain2'); |
304 | - $api->get('/prefix2/domain2', function () { |
|
304 | + $api->get('/prefix2/domain2', function() { |
|
305 | 305 | return 'hi'; |
306 | 306 | })->name('v2.prefix2.domain2'); |
307 | 307 | }); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $routeRules[0]['match']['prefixes'] = ['prefix1/*']; |
84 | 84 | $matcher = new RouteMatcher(); |
85 | 85 | $routes = $matcher->getRoutes($routeRules); |
86 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustInclude) { |
|
86 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustInclude) { |
|
87 | 87 | return $route['route']->getName() === $mustInclude; |
88 | 88 | }); |
89 | 89 | $this->assertCount(1, $oddRuleOut); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $routeRules[0]['match']['prefixes'] = ['prefix1/*']; |
101 | 101 | $matcher = new RouteMatcher(); |
102 | 102 | $routes = $matcher->getRoutes($routeRules); |
103 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustInclude) { |
|
103 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustInclude) { |
|
104 | 104 | return in_array($route['route']->getName(), $mustInclude); |
105 | 105 | }); |
106 | 106 | $this->assertCount(count($mustInclude), $oddRuleOut); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $routeRules[0]['match']['prefixes'] = ['prefix1/*']; |
117 | 117 | $matcher = new RouteMatcher(); |
118 | 118 | $routes = $matcher->getRoutes($routeRules); |
119 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustNotInclude) { |
|
119 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustNotInclude) { |
|
120 | 120 | return $route['route']->getName() === $mustNotInclude; |
121 | 121 | }); |
122 | 122 | $this->assertCount(0, $oddRuleOut); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $routeRules[0]['match']['prefixes'] = ['prefix1/*']; |
134 | 134 | $matcher = new RouteMatcher(); |
135 | 135 | $routes = $matcher->getRoutes($routeRules); |
136 | - $oddRuleOut = collect($routes)->filter(function ($route) use ($mustNotInclude) { |
|
136 | + $oddRuleOut = collect($routes)->filter(function($route) use ($mustNotInclude) { |
|
137 | 137 | return in_array($route['route']->getName(), $mustNotInclude); |
138 | 138 | }); |
139 | 139 | $this->assertCount(0, $oddRuleOut); |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | $this->assertCount(4, $routes); |
164 | 164 | |
165 | 165 | $routes = collect($routes); |
166 | - $firstRuleGroup = $routes->filter(function ($route) { |
|
166 | + $firstRuleGroup = $routes->filter(function($route) { |
|
167 | 167 | return Str::is('prefix1/*', $route['route']->uri()) |
168 | 168 | && Str::is('domain1.*', $route['route']->getDomain()); |
169 | 169 | }); |
170 | 170 | $this->assertCount(2, $firstRuleGroup); |
171 | 171 | |
172 | - $secondRuleGroup = $routes->filter(function ($route) { |
|
172 | + $secondRuleGroup = $routes->filter(function($route) { |
|
173 | 173 | return Str::is('prefix2/*', $route['route']->uri()) |
174 | 174 | && Str::is('domain2.*', $route['route']->getDomain()); |
175 | 175 | }); |
@@ -178,43 +178,43 @@ discard block |
||
178 | 178 | |
179 | 179 | private function registerLaravelRoutes() |
180 | 180 | { |
181 | - RouteFacade::group(['domain' => 'domain1.app.test'], function () { |
|
182 | - RouteFacade::post('/domain1-1', function () { |
|
181 | + RouteFacade::group(['domain' => 'domain1.app.test'], function() { |
|
182 | + RouteFacade::post('/domain1-1', function() { |
|
183 | 183 | return 'hi'; |
184 | 184 | })->name('domain1-1'); |
185 | - RouteFacade::get('domain1-2', function () { |
|
185 | + RouteFacade::get('domain1-2', function() { |
|
186 | 186 | return 'hi'; |
187 | 187 | })->name('domain1-2'); |
188 | - RouteFacade::get('/prefix1/domain1-1', function () { |
|
188 | + RouteFacade::get('/prefix1/domain1-1', function() { |
|
189 | 189 | return 'hi'; |
190 | 190 | })->name('prefix1.domain1-1'); |
191 | - RouteFacade::get('prefix1/domain1-2', function () { |
|
191 | + RouteFacade::get('prefix1/domain1-2', function() { |
|
192 | 192 | return 'hi'; |
193 | 193 | })->name('prefix1.domain1-2'); |
194 | - RouteFacade::get('/prefix2/domain1-1', function () { |
|
194 | + RouteFacade::get('/prefix2/domain1-1', function() { |
|
195 | 195 | return 'hi'; |
196 | 196 | })->name('prefix2.domain1-1'); |
197 | - RouteFacade::get('prefix2/domain1-2', function () { |
|
197 | + RouteFacade::get('prefix2/domain1-2', function() { |
|
198 | 198 | return 'hi'; |
199 | 199 | })->name('prefix2.domain1-2'); |
200 | 200 | }); |
201 | - RouteFacade::group(['domain' => 'domain2.app.test'], function () { |
|
202 | - RouteFacade::post('/domain2-1', function () { |
|
201 | + RouteFacade::group(['domain' => 'domain2.app.test'], function() { |
|
202 | + RouteFacade::post('/domain2-1', function() { |
|
203 | 203 | return 'hi'; |
204 | 204 | })->name('domain2-1'); |
205 | - RouteFacade::get('domain2-2', function () { |
|
205 | + RouteFacade::get('domain2-2', function() { |
|
206 | 206 | return 'hi'; |
207 | 207 | })->name('domain2-2'); |
208 | - RouteFacade::get('/prefix1/domain2-1', function () { |
|
208 | + RouteFacade::get('/prefix1/domain2-1', function() { |
|
209 | 209 | return 'hi'; |
210 | 210 | })->name('prefix1.domain2-1'); |
211 | - RouteFacade::get('prefix1/domain2-2', function () { |
|
211 | + RouteFacade::get('prefix1/domain2-2', function() { |
|
212 | 212 | return 'hi'; |
213 | 213 | })->name('prefix1.domain2-2'); |
214 | - RouteFacade::get('/prefix2/domain2-1', function () { |
|
214 | + RouteFacade::get('/prefix2/domain2-1', function() { |
|
215 | 215 | return 'hi'; |
216 | 216 | })->name('prefix2.domain2-1'); |
217 | - RouteFacade::get('prefix2/domain2-2', function () { |
|
217 | + RouteFacade::get('prefix2/domain2-2', function() { |
|
218 | 218 | return 'hi'; |
219 | 219 | })->name('prefix2.domain2-2'); |
220 | 220 | }); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | |
8 | 8 | Route::namespace('\Mpociot\ApiDoc\Http') |
9 | 9 | ->middleware($middleware) |
10 | - ->group(function () use ($prefix) { |
|
10 | + ->group(function() use ($prefix) { |
|
11 | 11 | Route::get($prefix, 'Controller@html')->name('apidoc'); |
12 | 12 | Route::get("$prefix.json", 'Controller@json')->name('apidoc.json'); |
13 | 13 | }); |