DashboardServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 3
dl 0
loc 40
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 15 2
A provides() 0 4 1
1
<?php namespace Modules\Dashboard\Providers;
2
3
use Illuminate\Support\ServiceProvider;
4
use Modules\Dashboard\Entities\Widget;
5
use Modules\Dashboard\Repositories\Cache\CacheWidgetDecorator;
6
use Modules\Dashboard\Repositories\Eloquent\EloquentWidgetRepository;
7
8
class DashboardServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = false;
16
17
    /**
18
     * Register the service provider.
19
     *
20
     * @return void
21
     */
22
    public function register()
23
    {
24
        $this->app->bind(
25
            'Modules\Dashboard\Repositories\WidgetRepository',
26
            function () {
27
                $repository = new EloquentWidgetRepository(new Widget());
28
29
                if (! config('app.cache')) {
30
                    return $repository;
31
                }
32
33
                return new CacheWidgetDecorator($repository);
34
            }
35
        );
36
    }
37
38
    /**
39
     * Get the services provided by the provider.
40
     *
41
     * @return array
42
     */
43
    public function provides()
44
    {
45
        return array();
46
    }
47
}
48