LaravelSitemapServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 11
ccs 8
cts 8
cp 1
crap 2
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\LaravelSitemap;
6
7
use Arcanedev\LaravelSitemap\Contracts\SitemapManager as SitemapManagerContract;
8
use Arcanedev\Support\Providers\PackageServiceProvider;
9
use Illuminate\Contracts\Support\DeferrableProvider;
10
11
/**
12
 * Class     LaravelSitemapServiceProvider
13
 *
14
 * @package  Arcanedev\LaravelSitemap
15
 * @author   ARCANEDEV <[email protected]>
16
 */
17
class LaravelSitemapServiceProvider extends PackageServiceProvider implements DeferrableProvider
18
{
19
    /* -----------------------------------------------------------------
20
     |  Properties
21
     | -----------------------------------------------------------------
22
     */
23
24
    /**
25
     * Package name.
26
     *
27
     * @var string
28
     */
29
    protected $package = 'sitemap';
30
31
    /* -----------------------------------------------------------------
32
     |  Main Methods
33
     | -----------------------------------------------------------------
34
     */
35
36
    /**
37
     * Register the service provider.
38
     */
39 330
    public function register(): void
40
    {
41 330
        parent::register();
42
43 330
        $this->registerConfig();
44
45 330
        $this->singleton(SitemapManagerContract::class, SitemapManager::class);
46 330
    }
47
48
49
    /**
50
     * Boot the service provider.
51
     */
52 330
    public function boot(): void
53
    {
54 330
        $this->loadTranslations();
55 330
        $this->loadViews();
56
57 330
        if ($this->app->runningInConsole()) {
58 330
            $this->publishConfig();
59 330
            $this->publishTranslations();
60 330
            $this->publishViews();
61
        }
62 330
    }
63
64
    /**
65
     * Get the services provided by the provider.
66
     *
67
     * @return array
68
     */
69 12
    public function provides(): array
70
    {
71
        return [
72 12
            SitemapManagerContract::class,
73
        ];
74
    }
75
}
76