Completed
Pull Request — master (#659)
by Andrey
02:02
created

ApiDoc   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A routes() 0 10 1
A middleware() 0 4 1
1
<?php
2
3
namespace Mpociot\ApiDoc;
4
5
use Illuminate\Support\Facades\Route;
6
7
class ApiDoc
8
{
9
    /**
10
     * Binds the ApiDoc routes into the controller.
11
     *
12
     * @deprecated Use autoload routes instead (`config/apidoc.php`: `routes > laravel > autoload`).
13
     *
14
     * @param string $path
15
     */
16
    public static function routes($path = '/doc')
17
    {
18
        Route::prefix($path)
19
            ->namespace('\Mpociot\ApiDoc\Http')
20
            ->middleware(static::middleware())
21
            ->group(function () {
22
                Route::get('/', 'Controller@blade')->name('apidoc');
23
                Route::get('.json', 'Controller@json')->name('apidoc.json');
24
            });
25
    }
26
27
    /**
28
     * Get the middlewares for Laravel routes.
29
     *
30
     * @return array
31
     */
32
    protected static function middleware()
33
    {
34
        return config('apidoc.laravel.middleware', []);
35
    }
36
}
37