TableAwareOperationTrait::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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