Passed
Push — main ( fcc250...3046a8 )
by Tan
02:22
created

BlogApiServiceProvider::boot()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
nc 2
nop 0
dl 0
loc 12
c 1
b 0
f 0
cc 2
rs 10
1
<?php
2
3
namespace CSlant\Blog\Api\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class Blog\ApiServiceProvider extends ServiceProvider
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_NAME_QUALIFIED, expecting T_STRING on line 7 at column 6
Loading history...
8
{
9
    /**
10
     * Bootstrap services.
11
     *
12
     * @return void
13
     */
14
    public function boot(): void
15
    {
16
        $routePath = __DIR__.'/../../routes/blog-api.php';
17
        if (file_exists($routePath)) {
18
            $this->loadRoutesFrom($routePath);
19
        }
20
21
        $this->loadTranslationsFrom(__DIR__.'/../../lang', 'blog-api');
22
23
        $this->registerCommands();
24
25
        $this->registerAssetPublishing();
26
    }
27
28
    /**
29
     * Register services.
30
     *
31
     * @return void
32
     */
33
    public function register(): void
34
    {
35
        $configPath = __DIR__.'/../../config/blog-api.php';
36
        $this->mergeConfigFrom($configPath, 'blog-api');
37
    }
38
39
    /**
40
     * Get the services provided by the provider.
41
     *
42
     * @return array<string>|null
43
     */
44
    public function provides(): ?array
45
    {
46
        return ['blog-api'];
47
    }
48
49
    /**
50
     * @return void
51
     */
52
    protected function registerCommands(): void
53
    {
54
        $this->commands([
55
            //
56
        ]);
57
    }
58
59
    /**
60
     * @return void
61
     */
62
    protected function registerAssetPublishing(): void
63
    {
64
        $configPath = __DIR__.'/../../config/blog-api.php';
65
        $this->publishes([
66
            $configPath => config_path('blog-api.php'),
67
        ], 'config');
68
69
        $this->publishes([
70
            __DIR__.'/../../lang' => resource_path('lang/packages/blog-api'),
71
        ], 'lang');
72
    }
73
}
74