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

DynamoDbClientFactory::factory()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
ccs 4
cts 4
cp 1
cc 2
nc 2
nop 1
crap 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