Completed
Push — master ( c02e16...8eb818 )
by Guillermo A.
02:37
created

LocalDynamoDbClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 26
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 14 2
1
<?php
2
3
namespace Guillermoandrae\Db\DynamoDb;
4
5
use Aws\DynamoDb\DynamoDbClient;
6
7
final class LocalDynamoDbClient
8
{
9
    /**
10
     * @var DynamoDbClient The DynamoDB client.
11
     */
12
    private static $instance;
13
    
14
    /**
15
     * Returns an instance of the DynamoDB client.
16
     *
17
     * @return DynamoDbClient
18
     */
19 16
    public static function get(): DynamoDbClient
20
    {
21 16
        if (!self::$instance) {
22 1
            self::$instance = new DynamoDbClient([
23 1
                'region' => 'us-west-2',
24
                'version'  => 'latest',
25
                'endpoint' => 'http://localhost:8000',
26
                'credentials' => [
27
                    'key' => 'not-a-real-key',
28
                    'secret' => 'not-a-real-secret',
29
                ],
30
            ]);
31
        }
32 16
        return self::$instance;
33
    }
34
}
35