Completed
Push — master ( 335da2...6aa3b5 )
by Marcel
10s
created

ApiDocGeneratorServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Importance

Changes 6
Bugs 4 Features 1
Metric Value
wmc 4
c 6
b 4
f 1
lcom 2
cbo 3
dl 0
loc 49
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 9 1
A register() 0 14 1
A resource_path() 0 4 2
1
<?php
2
3
namespace Mpociot\ApiDoc;
4
5
use Illuminate\Support\ServiceProvider;
6
use Mpociot\ApiDoc\Commands\UpdateDocumentation;
7
use Mpociot\ApiDoc\Commands\GenerateDocumentation;
8
9
class ApiDocGeneratorServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap the application events.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->loadViewsFrom(__DIR__.'/../../resources/views/', 'apidoc');
19
        $this->loadTranslationsFrom(__DIR__.'/../../resources/lang', 'apidoc');
20
21
        $this->publishes([
22
            __DIR__.'/../../resources/lang' => $this->resource_path('lang/vendor/apidoc'),
23
        ]);
24
    }
25
26
    /**
27
     * Register the API doc commands.
28
     *
29
     * @return void
30
     */
31
    public function register()
32
    {
33
        $this->app['apidoc.generate'] = $this->app->share(function () {
34
            return new GenerateDocumentation();
35
        });
36
        $this->app['apidoc.update'] = $this->app->share(function () {
37
            return new UpdateDocumentation();
38
        });
39
40
        $this->commands([
41
            'apidoc.generate',
42
            'apidoc.update',
43
        ]);
44
    }
45
46
    /**
47
     * Return a fully qualified path to a given file.
48
     *
49
     * @param string $path
50
     *
51
     * @return string
52
     */
53
    public function resource_path($path = '')
54
    {
55
        return app()->basePath().'/resources'.($path ? '/'.$path : $path);
56
    }
57
}
58