Total Complexity | 4 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Coverage | 88.89% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | final class ArrayDataSet implements DataSetInterface |
||
11 | { |
||
12 | private array $data; |
||
13 | |||
14 | 1 | public function __construct(array $data = []) |
|
17 | 1 | } |
|
18 | |||
19 | 1 | public function getAttributeValue(string $attribute) |
|
20 | { |
||
21 | 1 | if (!$this->hasAttribute($attribute)) { |
|
22 | throw new MissingAttributeException("There is no \"$attribute\" key in the array."); |
||
23 | } |
||
24 | |||
25 | 1 | return $this->data[$attribute]; |
|
26 | } |
||
27 | |||
28 | 1 | public function hasAttribute(string $attribute): bool |
|
31 | } |
||
32 | } |
||
33 |