Completed
Pull Request — master (#142)
by Bao
09:53
created

ExecutableQuery::__call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace BaoPham\DynamoDb\DynamoDb;
4
5
use Aws\DynamoDb\DynamoDbClient;
6
use BaoPham\DynamoDb\RawDynamoDbQuery;
7
8
/**
9
 * Class ExecutableQuery
10
 *
11
 * @package BaoPham\DynamoDb\DynamoDb
12
 *
13
 * @method \Aws\Result batchGetItem()
14
 * @method \GuzzleHttp\Promise\Promise batchGetItemAsync()
15
 * @method \Aws\Result batchWriteItem()
16
 * @method \GuzzleHttp\Promise\Promise batchWriteItemAsync()
17
 * @method \Aws\Result createTable()
18
 * @method \GuzzleHttp\Promise\Promise createTableAsync()
19
 * @method \Aws\Result deleteItem()
20
 * @method \GuzzleHttp\Promise\Promise deleteItemAsync()
21
 * @method \Aws\Result deleteTable()
22
 * @method \GuzzleHttp\Promise\Promise deleteTableAsync()
23
 * @method \Aws\Result describeTable()
24
 * @method \GuzzleHttp\Promise\Promise describeTableAsync()
25
 * @method \Aws\Result getItem()
26
 * @method \GuzzleHttp\Promise\Promise getItemAsync()
27
 * @method \Aws\Result listTables()
28
 * @method \GuzzleHttp\Promise\Promise listTablesAsync()
29
 * @method \Aws\Result putItem()
30
 * @method \GuzzleHttp\Promise\Promise putItemAsync()
31
 * @method \Aws\Result query()
32
 * @method \GuzzleHttp\Promise\Promise queryAsync()
33
 * @method \Aws\Result scan()
34
 * @method \GuzzleHttp\Promise\Promise scanAsync()
35
 * @method \Aws\Result updateItem()
36
 * @method \GuzzleHttp\Promise\Promise updateItemAsync()
37
 * @method \Aws\Result updateTable()
38
 * @method \GuzzleHttp\Promise\Promise updateTableAsync()
39
 * @method \Aws\Result createBackup() (supported in versions 2012-08-10)
40
 * @method \GuzzleHttp\Promise\Promise createBackupAsync() (supported in versions 2012-08-10)
41
 * @method \Aws\Result createGlobalTable() (supported in versions 2012-08-10)
42
 * @method \GuzzleHttp\Promise\Promise createGlobalTableAsync() (supported in versions 2012-08-10)
43
 * @method \Aws\Result deleteBackup() (supported in versions 2012-08-10)
44
 * @method \GuzzleHttp\Promise\Promise deleteBackupAsync() (supported in versions 2012-08-10)
45
 * @method \Aws\Result describeBackup() (supported in versions 2012-08-10)
46
 * @method \GuzzleHttp\Promise\Promise describeBackupAsync() (supported in versions 2012-08-10)
47
 * @method \Aws\Result describeContinuousBackups() (supported in versions 2012-08-10)
48
 * @method \GuzzleHttp\Promise\Promise describeContinuousBackupsAsync() (supported in versions 2012-08-10)
49
 * @method \Aws\Result describeGlobalTable() (supported in versions 2012-08-10)
50
 * @method \GuzzleHttp\Promise\Promise describeGlobalTableAsync() (supported in versions 2012-08-10)
51
 * @method \Aws\Result describeLimits() (supported in versions 2012-08-10)
52
 * @method \GuzzleHttp\Promise\Promise describeLimitsAsync() (supported in versions 2012-08-10)
53
 * @method \Aws\Result describeTimeToLive() (supported in versions 2012-08-10)
54
 * @method \GuzzleHttp\Promise\Promise describeTimeToLiveAsync() (supported in versions 2012-08-10)
55
 * @method \Aws\Result listBackups() (supported in versions 2012-08-10)
56
 * @method \GuzzleHttp\Promise\Promise listBackupsAsync() (supported in versions 2012-08-10)
57
 * @method \Aws\Result listGlobalTables() (supported in versions 2012-08-10)
58
 * @method \GuzzleHttp\Promise\Promise listGlobalTablesAsync() (supported in versions 2012-08-10)
59
 * @method \Aws\Result listTagsOfResource() (supported in versions 2012-08-10)
60
 * @method \GuzzleHttp\Promise\Promise listTagsOfResourceAsync() (supported in versions 2012-08-10)
61
 * @method \Aws\Result restoreTableFromBackup() (supported in versions 2012-08-10)
62
 * @method \GuzzleHttp\Promise\Promise restoreTableFromBackupAsync() (supported in versions 2012-08-10)
63
 * @method \Aws\Result tagResource() (supported in versions 2012-08-10)
64
 * @method \GuzzleHttp\Promise\Promise tagResourceAsync() (supported in versions 2012-08-10)
65
 * @method \Aws\Result untagResource() (supported in versions 2012-08-10)
66
 * @method \GuzzleHttp\Promise\Promise untagResourceAsync() (supported in versions 2012-08-10)
67
 * @method \Aws\Result updateGlobalTable() (supported in versions 2012-08-10)
68
 * @method \GuzzleHttp\Promise\Promise updateGlobalTableAsync() (supported in versions 2012-08-10)
69
 * @method \Aws\Result updateTimeToLive() (supported in versions 2012-08-10)
70
 * @method \GuzzleHttp\Promise\Promise updateTimeToLiveAsync() (supported in versions 2012-08-10)
71
 */
72
class ExecutableQuery
73
{
74
    /**
75
     * @var DynamoDbClient
76
     */
77
    private $client;
78
79
    /**
80
     * @var array
81
     */
82
    public $query;
83
84 121
    public function __construct(DynamoDbClient $client, array $query)
85
    {
86 121
        $this->client = $client;
87 121
        $this->query = $query;
88 121
    }
89
90
    /**
91
     * @param  string $method
92
     * @param  array  $parameters
93
     * @return mixed
94
     */
95 45
    public function __call($method, $parameters)
96
    {
97 45
        return $this->client->{$method}($this->query);
98
    }
99
}
100