Completed
Pull Request — master (#659)
by Andrey
02:47 queued 01:23
created

ApiDocGeneratorServiceProvider::bootRoutes()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Mpociot\ApiDoc;
4
5
use Illuminate\Support\ServiceProvider;
6
use Mpociot\ApiDoc\Commands\GenerateDocumentation;
7
use Mpociot\ApiDoc\Commands\RebuildDocumentation;
8
use Mpociot\ApiDoc\Matching\RouteMatcherInterface;
9
10
class ApiDocGeneratorServiceProvider extends ServiceProvider
11
{
12
    /**
13
     * Bootstrap the application events.
14
     *
15
     * @return void
16
     */
17
    public function boot()
18
    {
19
        $this->loadViewsFrom(__DIR__.'/../resources/views/', 'apidoc');
20
21
        $this->publishes([
22
            __DIR__.'/../resources/views' => app()->basePath().'/resources/views/vendor/apidoc',
23
        ], 'apidoc-views');
24
25
        $this->publishes([
26
            __DIR__.'/../config/apidoc.php' => app()->basePath().'/config/apidoc.php',
27
        ], 'apidoc-config');
28
29
        $this->mergeConfigFrom(__DIR__.'/../config/apidoc.php', 'apidoc');
30
31
        $this->bootRoutes();
32
33
        if ($this->app->runningInConsole()) {
34
            $this->commands([
35
                GenerateDocumentation::class,
36
                RebuildDocumentation::class,
37
            ]);
38
        }
39
40
        // Bind the route matcher implementation
41
        $this->app->bind(RouteMatcherInterface::class, $this->app['config']['apidoc']['routeMatcher']);
42
    }
43
44
    /**
45
     * Register the API doc commands.
46
     *
47
     * @return void
48
     */
49
    public function register()
50
    {
51
    }
52
53
    protected function bootRoutes()
54
    {
55
        if (config('apidoc.type', 'static') == 'laravel') {
56
            $this->loadRoutesFrom(
57
                __DIR__.'/../routes/laravel.php'
58
            );
59
        }
60
    }
61
}
62