SnsMiddlewareServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 2
b 0
f 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 2 1
A register() 0 10 1
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