ServiceProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php namespace Rocket\UI\Script\Support\Laravel5;
2
3
/**
4
 * Register special service providers
5
 */
6
class ServiceProvider extends \Illuminate\Support\ServiceProvider
7
{
8
    /**
9
     * {@inheritdoc}
10
     */
11
    public function register()
12
    {
13
14
        $this->shareJS();
15
    }
16
17
    protected function shareJS()
18
    {
19
        $this->app->singleton(
20
            'js',
21
            function () {
22
                $js = new JS([]);
23
                $this->app['events']->dispatch('js.init', [$js]);
24
25
                return $js;
26
            }
27
        );
28
    }
29
}
30