DynamoDbManager   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 12
c 1
b 0
f 0
dl 0
loc 62
ccs 18
cts 18
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A table() 0 3 1
A newQuery() 0 3 1
A __construct() 0 4 1
A marshalItem() 0 3 1
A unmarshalItem() 0 3 1
A client() 0 3 1
A unmarshalValue() 0 3 1
A marshalValue() 0 3 1
1
<?php
2
3
namespace BaoPham\DynamoDb\DynamoDb;
4
5
use BaoPham\DynamoDb\DynamoDbClientInterface;
6
7
/**
8
 * Class DynamoDb
9
 *
10
 * @package BaoPham\DynamoDb\DynamoDb
11
 */
12
class DynamoDbManager
13
{
14
    /**
15
     * @var DynamoDbClientInterface
16
     */
17
    private $service;
18
19
    /**
20
     * @var \Aws\DynamoDb\Marshaler
21
     */
22
    public $marshaler;
23
24 143
    public function __construct(DynamoDbClientInterface $service)
25
    {
26 143
        $this->service = $service;
27 143
        $this->marshaler = $service->getMarshaler();
28 143
    }
29
30 59
    public function marshalItem($item)
31
    {
32 59
        return $this->marshaler->marshalItem($item);
33
    }
34
35 71
    public function marshalValue($value)
36
    {
37 71
        return $this->marshaler->marshalValue($value);
38
    }
39
40 114
    public function unmarshalItem($item)
41
    {
42 114
        return $this->marshaler->unmarshalItem($item);
43
    }
44
45 1
    public function unmarshalValue($value)
46
    {
47 1
        return $this->marshaler->unmarshalValue($value);
48
    }
49
50
    /**
51
     * @param string|null $connection
52
     * @return \Aws\DynamoDb\DynamoDbClient
53
     */
54 2
    public function client($connection = null)
55
    {
56 2
        return $this->service->getClient($connection);
57
    }
58
59
    /**
60
     * @return QueryBuilder
61
     */
62 137
    public function newQuery()
63
    {
64 137
        return new QueryBuilder($this->service);
65
    }
66
67
    /**
68
     * @param string $table
69
     * @return QueryBuilder
70
     */
71 131
    public function table($table)
72
    {
73 131
        return $this->newQuery()->setTableName($table);
74
    }
75
}
76