Completed
Push — master ( 145f79...b857c9 )
by Sam
03:38
created

AbstractContentfulSyncServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
registerContentfulSyncServiceBindings() 0 1 ?
A register() 0 20 1
A boot() 0 3 1
1
<?php
2
3
namespace Digia\Lumen\ContentfulSync\Providers;
4
5
use Digia\Lumen\ContentfulSync\Console\Commands\SyncAssetsCommand;
6
use Digia\Lumen\ContentfulSync\Console\Commands\SyncContentsCommand;
7
use Digia\Lumen\ContentfulSync\Contracts\ContentfulSyncServiceContract;
8
use Illuminate\Support\ServiceProvider;
9
use Jalle19\Laravel\LostInterfaces\Providers\ServiceProvider as ServiceProviderInterface;
10
use Laravel\Lumen\Application;
11
use Nord\Lumen\Contentful\ContentfulServiceContract;
12
13
/**
14
 * Class AbstractContentfulSyncServiceProvider
15
 * @package Digia\Lumen\ContentfulSync\Providers
16
 */
17
abstract class AbstractContentfulSyncServiceProvider extends ServiceProvider implements ServiceProviderInterface
18
{
19
20
    /**
21
     * @param Application $app
22
     */
23
    abstract protected function registerContentfulSyncServiceBindings(Application $app);
24
25
    /**
26
     * @inheritDoc
27
     */
28
    public function register()
29
    {
30
        app()->configure('contentfulSync');
31
32
        // Configure how ContentfulSyncServiceContract should be built
33
        $this->registerContentfulSyncServiceBindings(app());
34
35
        // Configure how commands should be built
36
        app()->bind(SyncAssetsCommand::class, function (Application $app) {
37
            return new SyncAssetsCommand(config('contentfulSync.content_types'),
38
                $app->make(ContentfulServiceContract::class),
39
                $app->make(ContentfulSyncServiceContract::class));
40
        });
41
42
        app()->bind(SyncContentsCommand::class, function (Application $app) {
43
            return new SyncContentsCommand(config('contentfulSync.content_types'),
44
                $app->make(ContentfulServiceContract::class),
45
                $app->make(ContentfulSyncServiceContract::class));
46
        });
47
    }
48
49
    /**
50
     * @inheritDoc
51
     */
52
    public function boot()
53
    {
54
    }
55
}
56