Completed
Push — master ( a7a349...3fc402 )
by Guillermo A.
03:23
created

DescribeTableOperation::execute()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
rs 10
ccs 5
cts 5
cp 1
cc 2
nc 3
nop 0
crap 2
1
<?php
2
3
namespace Guillermoandrae\DynamoDb\Operation;
4
5
use Aws\DynamoDb\Exception\DynamoDbException;
6
use Guillermoandrae\DynamoDb\Contract\AbstractTableAwareOperation;
7
use Guillermoandrae\DynamoDb\Exception;
8
9
final class DescribeTableOperation extends AbstractTableAwareOperation
10
{
11
    /**
12
     * {@inheritDoc}
13
     * @link https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-dynamodb-2012-08-10.html#describetable
14
     */
15 2
    public function execute(): ?array
16
    {
17
        try {
18 2
            $result = $this->client->describeTable($this->toArray());
19 1
            return $result['Table'];
20 1
        } catch (DynamoDbException $ex) {
21 1
            throw new Exception($ex->getMessage());
22
        }
23
    }
24
}
25