Completed
Push — master ( 19c355...d500cb )
by Guillermo A.
02:33
created

AbstractOperation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 1
b 0
f 0
dl 0
loc 42
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setTableName() 0 4 1
A toArray() 0 4 1
A __construct() 0 5 1
1
<?php
2
3
namespace Guillermoandrae\DynamoDb\Contract;
4
5
use Aws\DynamoDb\DynamoDbClient;
6
use Aws\DynamoDb\Marshaler;
7
8
abstract class AbstractOperation implements OperationInterface
9
{
10
    use DynamoDbClientAwareTrait;
11
12
    /**
13
     * @var string The table name.
14
     */
15
    protected $tableName;
16
17
    /**
18
     * Registers the DynamoDb client, Marshaler, and table name with this object.
19
     *
20
     * @param DynamoDbClient $client The DynamoDb client.
21
     * @param Marshaler $marshaler The Marshaler.
22
     * @param string $tableName The table name.
23
     */
24 28
    public function __construct(DynamoDbClient $client, Marshaler $marshaler, string $tableName)
25
    {
26 28
        $this->setClient($client);
27 28
        $this->setMarshaler($marshaler);
28 28
        $this->setTableName($tableName);
29 28
    }
30
31
    /**
32
     * Registers the table name.
33
     *
34
     * @param string $tableName The table name.
35
     * @return OperationInterface This object.
36
     */
37 32
    final public function setTableName(string $tableName): OperationInterface
38
    {
39 32
        $this->tableName = $tableName;
40 32
        return $this;
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46 35
    public function toArray(): array
47
    {
48
        return [
49 35
            'TableName' => $this->tableName,
50
        ];
51
    }
52
}
53