AwsPinpointServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 30
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A boot() 0 24 2
1
<?php
2
3
namespace NotificationChannels\AwsPinpoint;
4
5
use Aws\Laravel\AwsFacade;
6
use Illuminate\Support\ServiceProvider;
7
8
class AwsPinpointServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        $this->app->when(AwsPinpointChannel::class)
16
            ->needs(AwsPinpointClient::class)
17
            ->give(function () {
18
                $config = config('aws.Pinpoint');
19
20
                if (is_null($config)) {
21
                    throw InvalidConfiguration::configurationNotSet();
22
                }
23
24
                $client = AwsFacade::createClient(
25
                    'pinpoint',
26
                    [
27
                        'credentials' => [
28
                            'key' => $config['key'],
29
                            'secret' => $config['secret'],
30
                        ],
31
                    ]
32
                );
33
34
                return new AwsPinpointClient($client);
0 ignored issues
show
Documentation introduced by
$client is of type object<Aws\AwsClientInterface>, but the function expects a null|object<Aws\AwsClient>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
35
            });
36
    }
37
}
38