AdvertServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 29
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 17 2
A register() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of ibrand/advert.
5
 *
6
 * (c) iBrand <https://www.ibrand.cc>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace iBrand\Component\Advert;
13
14
use Illuminate\Database\Eloquent\Relations\Relation;
15
use iBrand\Component\Advert\Repositories\AdvertItemRepository;
16
use iBrand\Component\Advert\Repositories\AdvertRepository;
17
use iBrand\Component\Advert\Repositories\Eloquent\AdvertItemRepositoryEloquent;
18
use iBrand\Component\Advert\Repositories\Eloquent\AdvertRepositoryEloquent;
19
use Illuminate\Support\ServiceProvider;
20
21
class AdvertServiceProvider extends ServiceProvider
22
{
23
    /**
24
     *  Boot the service provider.
25
     */
26 4
    public function boot()
27
    {
28 4
        if (!class_exists('CreateAdvertTables')) {
29 1
            $timestamp = date('Y_m_d_His', time());
30 1
            $this->publishes([
31 1
                __DIR__.'/../migrations/create_advert_tables.php.stub' => database_path()."/migrations/{$timestamp}_create_advert_tables.php",
32 1
            ], 'migrations');
33
        }
34
35 4
        $this->publishes([
36 4
            __DIR__.'/../config/advert.php' => config_path('ibrand/advert.php'),
37
        ]);
38
39 4
        Relation::morphMap(
40 4
            config('ibrand.advert.models')
41
        );
42 4
    }
43
44 4
    public function register()
45
    {
46 4
        $this->app->bind(AdvertRepository::class, AdvertRepositoryEloquent::class);
47 4
        $this->app->bind(AdvertItemRepository::class, AdvertItemRepositoryEloquent::class);
48 4
    }
49
}
50