TableAwareOperationTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 4 1
A setTableName() 0 4 1
1
<?php
2
3
namespace Guillermoandrae\DynamoDb\Contract;
4
5
/**
6
 * Trait for table aware operation classes.
7
 *
8
 * @author Guillermo A. Fisher <[email protected]>
9
 */
10
trait TableAwareOperationTrait
11
{
12
    /**
13
     * @var string The table name.
14
     */
15
    protected string $tableName = '';
16
17
    /**
18
     * Registers the table name with this object.
19
     *
20
     * @param string $tableName The table name.
21
     * @return static This object.
22
     */
23 50
    final public function setTableName(string $tableName): static
24
    {
25 50
        $this->tableName = $tableName;
26 50
        return $this;
27
    }
28
29 53
    public function toArray(): array
30
    {
31
        return [
32 53
            'TableName' => $this->tableName,
33
        ];
34
    }
35
}
36