SitemapServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 18 1
A register() 0 4 1
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