SeoableServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 46
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 11 2
A register() 0 4 1
A publishResources() 0 20 2
1
<?php
2
3
namespace MadWeb\Seoable;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class SeoableServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12 27
    public function boot()
13
    {
14 27
        if ($this->app->runningInConsole()) {
15 27
            $this->publishResources();
16
        }
17
18
        // Translations
19 27
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'seoable');
20
21 27
        $this->app->register(\Artesaos\SEOTools\Providers\SEOToolsServiceProvider::class);
22 27
    }
23
24
    /**
25
     * Register the application services.
26
     */
27 27
    public function register()
28
    {
29 27
        $this->mergeConfigFrom(__DIR__.'/../config/seoable.php', 'seoable');
30 27
    }
31
32 27
    protected function publishResources()
33
    {
34
        // Config
35 27
        $this->publishes([
36 27
            __DIR__.'/../config/seoable.php' => config_path('seoable.php'),
37 27
        ], 'config');
38
39
        // Database
40 27
        if (! class_exists('CreateSeoTable')) {
41
            // Publish the migration
42 3
            $timestamp = date('Y_m_d_His', time());
43 3
            $this->publishes([
44 3
                __DIR__.'/../database/migrations/create_seo_table.php.stub' => $this->app->databasePath().'/migrations/'.$timestamp.'_create_seo_table.php',
45 3
            ], 'migrations');
46
        }
47
48 27
        $this->publishes([
49 27
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/seoable'),
50 27
        ], 'lang');
51 27
    }
52
}
53