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

RecipeServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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