Total Complexity | 3 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
7 | abstract class AbstractKeyAwareRequest extends AbstractItemRequest |
||
8 | { |
||
9 | /** |
||
10 | * @var array The primary key values to be used when retrieving items. |
||
11 | */ |
||
12 | protected $key; |
||
13 | |||
14 | /** |
||
15 | * Registers the Marshaler, table name, and primary key with this object. |
||
16 | * |
||
17 | * @param Marshaler $marshaler The Marshaler. |
||
18 | * @param string $tableName The table name. |
||
19 | * @param array $key The primary key values to be used when retrieving items. |
||
20 | */ |
||
21 | 4 | public function __construct(Marshaler $marshaler, string $tableName, array $key) |
|
22 | { |
||
23 | 4 | parent::__construct($marshaler, $tableName); |
|
24 | 4 | $this->setKey($key); |
|
25 | 4 | } |
|
26 | |||
27 | /** |
||
28 | * Registers the operation's primary key with this object. |
||
29 | * |
||
30 | * @param array $key The primary key values to be used when retrieving items. |
||
31 | * @return AbstractKeyAwareRequest An implementation of this abstract. |
||
32 | */ |
||
33 | 4 | public function setKey(array $key): AbstractKeyAwareRequest |
|
34 | { |
||
35 | 4 | $this->key = $this->marshaler->marshalItem($key); |
|
36 | 4 | return $this; |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * {@inheritDoc} |
||
41 | */ |
||
42 | 4 | public function get(): array |
|
48 | ]; |
||
49 | } |
||
50 | } |
||
51 |