ServiceProvider::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php namespace C4tech\RayEmitter;
2
3
use C4tech\RayEmitter\Event\Store;
4
use Illuminate\Support\Facades\App;
5
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
6
7
class ServiceProvider extends BaseServiceProvider
8
{
9
    protected $configPath = '';
10
11
    protected $migrationPath = '';
12
13
    /**
14
     * @inheritDoc
15
     */
16 4
    public function __construct($app)
17
    {
18 4
        $this->configPath = __DIR__ . '/../resources/config.php';
19 4
        $this->migrationPath = __DIR__ . '/../resources/migrations';
20
21 4
        parent::__construct($app);
22 4
    }
23
24
    /**
25
     * @inheritDoc
26
     */
27 1
    public function boot()
28
    {
29 1
        $configs = [];
30 1
        $configs[$this->configPath] = config_path('ray_emitter.php');
31 1
        $this->publishes($configs, 'config');
32
33 1
        $migrations = [];
34 1
        $migrations[$this->migrationPath] = database_path('migrations');
35 1
        $this->publishes($migrations, 'migrations');
36 1
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41 1
    public function register()
42
    {
43 1
        $this->mergeConfigFrom($this->configPath, 'ray_emitter');
44
45 1
        App::singleton(
46 1
            'rayemitter.store',
47 1
            function () {
48 1
                return new Store;
49
            }
50 1
        );
51 1
    }
52
53
    /**
54
     * @inheritDoc
55
     */
56 1
    public function provides()
57
    {
58 1
        return ['rayemitter.store'];
59
    }
60
}
61