DashboardServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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