ReturnConsumedCapacityAwareOperationTrait   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 setReturnConsumedCapacity() 0 4 1
1
<?php
2
3
namespace Guillermoandrae\DynamoDb\Contract;
4
5
use Guillermoandrae\DynamoDb\Constant\ReturnConsumedCapacityOptions;
6
7
/**
8
 * Trait for ReturnConsumedCapacity aware operations.
9
 *
10
 * @author Guillermo A. Fisher <[email protected]>
11
 */
12
trait ReturnConsumedCapacityAwareOperationTrait
13
{
14
    /**
15
     * @var string The level of detail about provisioned throughput consumption that is returned in the response.
16
     */
17
    protected string $returnConsumedCapacity = ReturnConsumedCapacityOptions::NONE;
18
19
    /**
20
     * Registers the desired level of consumption detail to return.
21
     *
22
     * @param string $returnConsumedCapacity The level of consumption detail to return.
23
     * @return static This object.
24
     */
25 1
    final public function setReturnConsumedCapacity(string $returnConsumedCapacity): static
26
    {
27 1
        $this->returnConsumedCapacity = $returnConsumedCapacity;
28 1
        return $this;
29
    }
30
31 32
    public function toArray(): array
32
    {
33
        return [
34 32
            'ReturnConsumedCapacity' => $this->returnConsumedCapacity
35
        ];
36
    }
37
}
38