SitemapServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Sitemap;
4
5
use Illuminate\Support\ServiceProvider;
6
use Spatie\Crawler\Crawler;
7
8
class SitemapServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'laravel-sitemap');
13
14
        $this->publishes([
15
            __DIR__.'/../resources/views' => base_path('resources/views/vendor/laravel-sitemap'),
16
        ], 'views');
17
18
        $this->publishes([
19
            __DIR__.'/../config/sitemap.php' => config_path('sitemap.php'),
20
        ], 'config');
21
22
        $this->app->when(SitemapGenerator::class)
23
            ->needs(Crawler::class)
24
            ->give(function () {
25
                return Crawler::create(config('sitemap.guzzle_options'));
26
            });
27
    }
28
29
    public function register()
30
    {
31
        $this->mergeConfigFrom(__DIR__.'/../config/sitemap.php', 'sitemap');
32
    }
33
}
34