Passed
Push — master ( 69f8ad...cfdf92 )
by Philippe
05:26 queued 10s
created

AssetLibraryServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 16
dl 0
loc 38
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
A publishMigrations() 0 13 3
1
<?php
2
3
namespace Thinktomorrow\AssetLibrary;
4
5
use Illuminate\Support\ServiceProvider;
6
use Thinktomorrow\AssetLibrary\Models\Asset;
7
8
class AssetLibraryServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = false;
16
17
    /**
18
     * Register any package services.
19
     *
20
     * @return void
21
     */
22 67
    public function register()
23
    {
24 67
        $this->publishes([
25 67
            __DIR__.'/../config/assetlibrary.php' => config_path('assetlibrary.php'),
26 67
        ], 'config');
27
28 67
        $this->mergeConfigFrom(__DIR__.'/../config/assetlibrary.php', 'assetlibrary');
29
30 67
        $this->publishMigrations();
31 67
    }
32
33 67
    public function publishMigrations(): void
34
    {
35 67
        if (! class_exists('CreateAssetTable')) {
36 1
            $this->publishes([
37 1
                __DIR__.'/../database/migrations/create_asset_table.php' => database_path('migrations/'.date('Y_m_d_His',
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 121 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
38 1
                        time()).'_create_asset_table.php'),
39 1
            ], 'migrations');
40
        }
41
42 67
        if (! class_exists('CreateMediaTable')) {
43 1
            $this->publishes([
44 1
                __DIR__.'/../../../spatie/laravel-medialibrary/database/migrations/create_media_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_media_table.php'),
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 196 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
45 1
            ], 'migrations');
46
        }
47 67
    }
48
}
49