ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
c 2
b 0
f 0
nc 2
nop 0
dl 0
loc 18
ccs 12
cts 12
cp 1
crap 2
rs 9.9666
1
<?php
2
3
namespace NovaSeoEntity;
4
5
use NovaSeoEntity\Models\SEOInfo;
6
7
class ServiceProvider extends \Illuminate\Support\ServiceProvider
8
{
9 9
    public function boot()
10
    {
11 9
        if ($this->app->runningInConsole()) {
12 9
            $this->publishes([
13 9
                __DIR__ . '/../config/nova-seo-entity.php' => config_path('nova-seo-entity.php'),
14 9
            ], 'config');
15
16 9
            $this->publishes([
17 9
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/nova-seo-entity'),
18 9
            ], 'lang');
19
20
21 9
            $this->commands([
22 9
                //
23 9
            ]);
24
        }
25
26 9
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'nova-seo-entity');
27
    }
28
29
    /**
30
     * @inheritDoc
31
     */
32 9
    public function register()
33
    {
34 9
        $this->mergeConfigFrom(__DIR__ . '/../config/nova-seo-entity.php', 'nova-seo-entity');
35
36
        // seo_image
37 9
        $config = $this->app->make('config');
38
39 9
        $config->set('simple-image-manager.drivers', array_merge(
40 9
            [ SEOInfo::$thinkSeoImgDriver => $config->get('nova-seo-entity.seo_image', []), ],
41 9
            $config->get('simple-image-manager.drivers', [])
42 9
        ));
43
    }
44
}
45