SnsMiddlewareServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Digia\Lumen\SnsMiddleware\Providers;
4
5
use Aws\Sns\MessageValidator;
6
use Digia\Lumen\SnsMiddleware\Http\Client\FileGetContentsHttpClient;
7
use Digia\Lumen\SnsMiddleware\Http\Client\HttpClientInterface;
8
use Illuminate\Support\ServiceProvider;
9
use Jalle19\Laravel\LostInterfaces\Providers\ServiceProvider as ServiceProviderInterface;
10
11
/**
12
 * Class SnsMiddlewareServiceProvider
13
 * @package Digia\Lumen\SnsMiddleware\Providers
14
 */
15
class SnsMiddlewareServiceProvider extends ServiceProvider implements ServiceProviderInterface
16
{
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function register()
22
    {
23
        $this->app->bind(HttpClientInterface::class, FileGetContentsHttpClient::class);
24
25
        $this->app->bind(MessageValidator::class, function ($app) {
26
            return new MessageValidator(function (string $url) use ($app) {
27
                /** @var HttpClientInterface $httpClient */
28
                $httpClient = $app->make(HttpClientInterface::class);
29
30
                return $httpClient->get($url);
31
            });
32
        });
33
    }
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function boot()
39
    {
40
41
    }
42
43
}
44