Completed
Push — master ( 20a668...02e94f )
by Guillermo A.
02:17
created

AbstractTableAwareRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 38
c 0
b 0
f 0
ccs 9
cts 9
cp 1
rs 10

3 Methods

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