CoreServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 2
cts 2
cp 1
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php namespace Arcanesoft\Core;
2
3
use Arcanesoft\Core\Bases\PackageServiceProvider;
4
5
/**
6
 * Class     FoundationServiceProvider
7
 *
8
 * @package  Arcanesoft\Foundation
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class CoreServiceProvider extends PackageServiceProvider
12
{
13
    /* -----------------------------------------------------------------
14
     |  Properties
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'core';
24
25
    /**
26
     * Register the core service provider.
27
     *
28
     * @var bool
29
     */
30
    protected $registerCoreServiceProvider = false;
31
32
    /* -----------------------------------------------------------------
33
     |  Main Methods
34
     | -----------------------------------------------------------------
35
     */
36
37
    /**
38
     * Register the service provider.
39
     */
40 124
    public function register()
41
    {
42 124
        parent::register();
43
44 124
        $this->registerConfig();
45 124
        $this->registerArcanesoftDatabase();
46 124
        $this->registerProviders([
47 124
            Providers\AuthorizationServiceProvider::class,
48
            Providers\RouteServiceProvider::class,
49
            Providers\PackagesServiceProvider::class,
50
        ]);
51 124
    }
52
53
    /**
54
     * Boot the service provider.
55
     */
56 124
    public function boot()
57
    {
58 124
        parent::boot();
59
60 124
        $this->publishViews();
61 124
        $this->publishTranslations();
62 124
    }
63
64
    /**
65
     * Get the services provided by the provider.
66
     *
67
     * @return array
68
     */
69 2
    public function provides()
70
    {
71
        return [
72
            //
73 2
        ];
74
    }
75
76
    /* -----------------------------------------------------------------
77
     |  Services Methods
78
     | -----------------------------------------------------------------
79
     */
80
81
    /**
82
     * Register Foundation database.
83
     */
84 124
    private function registerArcanesoftDatabase()
85
    {
86
        // Keep it or using a real DBMS ?
87 124
        $connection = $this->config()->get('core.database.default', 'sqlite');
88
89 124
        $this->config()->set(
90 124
            'database.connections.arcanesoft',
91 124
            $this->config()->get("core.database.connections.{$connection}")
92
        );
93 124
    }
94
}
95