Total Complexity | 5 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
14 | class ArrayResponse extends \ArrayObject implements ResponseInterface |
||
15 | { |
||
16 | private $name; |
||
17 | |||
18 | /** |
||
19 | * @param string $name |
||
20 | * @param array $data |
||
21 | */ |
||
22 | 46 | public function __construct(string $name, array $data) |
|
26 | } |
||
27 | |||
28 | 44 | public function getResponseName(): string |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * Object property access to ArrayObject data. |
||
35 | */ |
||
36 | 4 | public function __get($property) |
|
37 | { |
||
38 | 4 | $key = $this->transformPropertyName($property); |
|
39 | |||
40 | 4 | return $this[$key] ?? null; |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * Object property access to ArrayObject data. |
||
45 | */ |
||
46 | 1 | public function __isset($property) |
|
51 | } |
||
52 | |||
53 | // ---------------------------------------- |
||
54 | |||
55 | /** |
||
56 | * Tranform underscored property name to hyphenated array key. |
||
57 | */ |
||
58 | 4 | private function transformPropertyName(string $propertyName): string |
|
63 |