Completed
Push — master ( ee9403...effd37 )
by Guillermo A.
02:12
created

DeleteTableOperation::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
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 8
ccs 5
cts 5
cp 1
rs 10
cc 2
nc 2
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
/**
10
 * @link https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-dynamodb-2012-08-10.html#deletetable
11
 */
12
final class DeleteTableOperation extends AbstractTableAwareOperation
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17 8
    public function execute(): bool
18
    {
19
        try {
20 8
            $this->client->deleteTable($this->toArray());
21
            //$this->client->waitUntil('TableExists', ['TableName' => $this->tableName]);
22 7
            return true;
23 1
        } catch (DynamoDbException $ex) {
24 1
            throw new Exception($ex->getMessage());
25
        }
26
    }
27
}
28