ServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Benrowe\Laravel\Widgets;
4
5
use Arrilot\Widgets\Misc\LaravelApplicationWrapper;
6
use Arrilot\Widgets\ServiceProvider as BaseServiceProvider;
7
use Benrowe\Laravel\Widgets\Factories\WidgetFactory;
8
9
10
/**
11
 * @package Benrowe\Laravel\Widgets
12
 */
13
class ServiceProvider extends BaseServiceProvider
14
{
15
    /**
16
     * Suplement the base provider with a different version of the widget factory
17
     *
18
     * @return nil|null
19
     */
20
    public function register()
21
    {
22
        parent::register();
23
24
        $this->app->bind('arrilot.widget', function () {
25
            return new WidgetFactory(new LaravelApplicationWrapper());
26
        });
27
28
        $this->app->alias('arrilot.widget', 'Arrilot\Widgets\Factories\WidgetFactory');
29
30
    }
31
32
    /**
33
     * Register two additional blade directives
34
     *
35
     * @return nil|null
36
     */
37
    public function boot()
38
    {
39
        parent::boot();
40
        $this->registerBladeDirective('widget-begin', '$1<?php echo app("arrilot.widget")->begin$2; ?>');
41
        $this->registerBladeDirective('widget-end', '$1<?php echo app("arrilot.widget")->endw$2; ?>');
42
    }
43
}
44