Completed
Push — master ( bdfd9f...1d5273 )
by ARCANEDEV
03:44
created

FoundationServiceProvider::publishAssets()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
1
<?php namespace Arcanesoft\Foundation;
2
3
use Arcanesoft\Core\Bases\PackageServiceProvider;
4
use Arcanesoft\Core\CoreServiceProvider;
5
6
/**
7
 * Class     FoundationServiceProvider
8
 *
9
 * @package  Arcanesoft\Foundation
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class FoundationServiceProvider extends PackageServiceProvider
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Properties
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'foundation';
24
25
    /* ------------------------------------------------------------------------------------------------
26
     |  Getters & Setters
27
     | ------------------------------------------------------------------------------------------------
28
     */
29
    /**
30
     * Get the base path of the package.
31
     *
32
     * @return string
33
     */
34 12
    public function getBasePath()
35
    {
36 12
        return dirname(__DIR__);
37
    }
38
39
    /* ------------------------------------------------------------------------------------------------
40
     |  Main Functions
41
     | ------------------------------------------------------------------------------------------------
42
     */
43
    /**
44
     * Register the service provider.
45
     */
46 12
    public function register()
47
    {
48 12
        $this->registerConfig();
49 12
        $this->registerSidebarItems();
50 12
        $this->registerServiceProviders();
51 12
        $this->registerFoundationService();
52
53 12
        if ($this->app->runningInConsole()) {
54 12
            $this->app->register(Providers\CommandServiceProvider::class);
55 6
        }
56 12
    }
57
58
    /**
59
     * Boot the service provider.
60
     */
61 12
    public function boot()
62
    {
63 12
        $this->app->register(Providers\RouteServiceProvider::class);
64 12
        $this->app->register(Providers\ComposerServiceProvider::class);
65
66
        // Publishes
67 12
        $this->publishConfig();
68 12
        $this->publishViews();
69 12
        $this->publishTranslations();
70 12
        $this->publishSidebarItems();
71 12
    }
72
73
    /**
74
     * Get the services provided by the provider.
75
     *
76
     * @return array
77
     */
78 2
    public function provides()
79
    {
80 2
        return ['arcanesoft.foundation'];
81
    }
82
83
    /* ------------------------------------------------------------------------------------------------
84
     |  Services Functions
85
     | ------------------------------------------------------------------------------------------------
86
     */
87
    /**
88
     * Register all the required service providers.
89
     */
90 12
    private function registerServiceProviders()
91
    {
92 12
        $this->app->register(CoreServiceProvider::class);
93 12
        $this->app->register(Providers\PackagesServiceProvider::class);
94 12
        $this->app->register(Providers\ModuleServiceProvider::class);
95 12
        $this->app->register(Providers\AuthorizationServiceProvider::class);
96 12
    }
97
98
    /**
99
     * Register Foundation service.
100
     */
101 12
    private function registerFoundationService()
102
    {
103 12
        $this->singleton('arcanesoft.foundation', Foundation::class);
104 12
    }
105
}
106