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

LocalDynamoDbClient::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 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