Completed
Push — master ( 872cc5...a1b8a3 )
by ARCANEDEV
10s
created

BlogServiceProvider::getBasePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanesoft\Blog;
2
3
use Arcanesoft\Core\Bases\PackageServiceProvider;
4
use Illuminate\Support\Arr;
5
6
/**
7
 * Class     BlogServiceProvider
8
 *
9
 * @package  Arcanesoft\Blog
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class BlogServiceProvider extends PackageServiceProvider
0 ignored issues
show
Bug introduced by
There is one abstract method getBasePath in this class; you could implement it, or declare this class as abstract.
Loading history...
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Properties
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'blog';
24
25
    /* ------------------------------------------------------------------------------------------------
26
     |  Main Functions
27
     | ------------------------------------------------------------------------------------------------
28
     */
29
    /**
30
     * Register the service provider.
31
     */
32 6
    public function register()
33
    {
34 6
        parent::register();
35
36 6
        $this->registerConfig();
37 6
        $this->registerSidebarItems();
38 6
        $this->registerProviders([
39 6
            Providers\AuthorizationServiceProvider::class,
40 2
            Providers\ViewComposerServiceProvider::class,
41 2
            \Arcanedev\LaravelMarkdown\LaravelMarkdownServiceProvider::class,
42 2
        ]);
43 6
        $this->registerConsoleServiceProvider(Providers\CommandServiceProvider::class);
44 6
    }
45
46
    /**
47
     * Boot the service provider.
48
     */
49 6
    public function boot()
50
    {
51 6
        parent::boot();
52
53 6
        $this->registerProvider(Providers\RouteServiceProvider::class);
54 6
        $this->registerProvider(Providers\ViewComposerServiceProvider::class);
55
56 6
        $this->registerObservers();
57
58
        // Publishes
59 6
        $this->publishConfig();
60 6
        $this->publishViews();
61 6
        $this->publishTranslations();
62 6
        $this->publishSidebarItems();
63
64 6
        Blog::$runsMigrations ? $this->loadMigrations() : $this->publishMigrations();
65 6
    }
66
67
    /**
68
     * Get the services provided by the provider.
69
     *
70
     * @return array
71
     */
72 3
    public function provides()
73
    {
74
        return [
75
            //
76 3
        ];
77
    }
78
79
    /* ------------------------------------------------------------------------------------------------
80
     |  Other Functions
81
     | ------------------------------------------------------------------------------------------------
82
     */
83
    /**
84
     * Register the observers.
85
     */
86 6
    private function registerObservers()
87
    {
88 6
        $config = $this->config()->get('arcanesoft.blog');
89
90 6
        foreach (Arr::only($config, ['posts', 'categories', 'tags']) as $entity) {
91 6
            $this->app
92 6
                 ->make($entity['model'])
93 6
                 ->observe($entity['observer']);
94 2
        }
95 6
    }
96
}
97