Completed
Push — master ( a7a349...3fc402 )
by Guillermo A.
03:23
created

DynamoDbClientFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 18
rs 10
ccs 4
cts 4
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A factory() 0 6 2
1
<?php
2
3
namespace Guillermoandrae\DynamoDb\Factory;
4
5
use Aws\DynamoDb\DynamoDbClient;
6
7
final class DynamoDbClientFactory
8
{
9
    private static $defaultOptions = [
10
        'region' => 'us-west-2',
11
        'version'  => 'latest',
12
        'endpoint' => 'http://localhost:8000',
13
        'credentials' => [
14
            'key' => 'not-a-real-key',
15
            'secret' => 'not-a-real-secret',
16
        ]
17
    ];
18
19 42
    public static function factory(?array $options = []): DynamoDbClient
20
    {
21 42
        if (empty($options)) {
22 42
            $options = static::$defaultOptions;
0 ignored issues
show
Bug introduced by
Since $defaultOptions is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $defaultOptions to at least protected.
Loading history...
23
        }
24 42
        return new DynamoDbClient($options);
25
    }
26
}
27