Completed
Push — master ( 328857...405b9d )
by Basenko
03:28
created

SeoableServiceProvider   A

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 9
    public function boot()
13
    {
14 9
        if ($this->app->runningInConsole()) {
15 9
            $this->publishResources();
16
        }
17
18
        // Translations
19 9
        $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'seoable');
20
21 9
        $this->app->register(\Artesaos\SEOTools\Providers\SEOToolsServiceProvider::class);
22 9
    }
23
24
    /**
25
     * Register the application services.
26
     */
27 9
    public function register()
28
    {
29 9
        $this->mergeConfigFrom(__DIR__.'/../config/seoable.php', 'seoable');
30 9
    }
31
32 9
    protected function publishResources()
33
    {
34
        // Config
35 9
        $this->publishes([
36 9
            __DIR__.'/../config/seoable.php' => config_path('seoable.php'),
37 9
        ], 'config');
38
39
        // Database
40 9
        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',
0 ignored issues
show
Bug introduced by
The method databasePath() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean basePath()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
45 3
            ], 'migrations');
46
        }
47
48 9
        $this->publishes([
49 9
            __DIR__.'/../resources/lang' => resource_path('lang/vendor/seoable'),
50 9
        ], 'lang');
51 9
    }
52
}
53