Completed
Push — master ( 3a775b...45e4bb )
by Ben
03:48
created

ServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
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\ServiceProvider as BaseServiceProvider;
6
use Benrowe\Laravel\Widgets\Factories\WidgetFactory;
7
use Arrilot\Widgets\Misc\LaravelApplicationWrapper;
8
9
/**
10
 * @package Benrowe\Laravel\Widgets
11
 */
12
class ServiceProvider extends BaseServiceProvider
13
{
14
    /**
15
     * Suplement the base provider with a different version of the widget factory
16
     *
17
     * @return nil
0 ignored issues
show
Documentation introduced by
Should the return type not be nil|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
18
     */
19
    public function register()
20
    {
21
        parent::boot();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (boot() instead of register()). Are you sure this is correct? If so, you might want to change this to $this->boot().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
22
23
        $this->app->bind('arrilot.widget', function () {
24
            return new WidgetFactory(new LaravelApplicationWrapper());
25
        });
26
27
        $this->app->alias('arrilot.widget', 'Arrilot\Widgets\Factories\WidgetFactory');
28
29
    }
30
31
    /**
32
     * Register two additional blade directives
33
     *
34
     * @return nil
0 ignored issues
show
Documentation introduced by
Should the return type not be nil|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
35
     */
36
    public function boot()
37
    {
38
        parent::boot();
39
        $this->registerBladeDirective('widget-begin', '$1<?php echo app("arrilot.widget")->begin$2; ?>');
40
        $this->registerBladeDirective('widget-end', '$1<?php echo app("arrilot.widget")->endw$2; ?>');
41
    }
42
}
43