ServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 2
c 2
b 0
f 2
lcom 1
cbo 4
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 11 1
A boot() 0 6 1
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