Completed
Branch master (00d7a1)
by Nicolas
03:44
created

RecipeServiceProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

3 Methods

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