| Total Complexity | 6 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Coverage | 38.46% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | class ArrayResponse extends \ArrayObject implements Response |
||
| 15 | { |
||
| 16 | private $_name; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $name |
||
| 20 | * @param array $data |
||
| 21 | */ |
||
| 22 | 5 | public function __construct($name, $data) |
|
| 23 | { |
||
| 24 | 5 | $this->_name = $name; |
|
| 25 | 5 | parent::__construct($data); |
|
| 26 | } |
||
| 27 | |||
| 28 | /* (non-phpdoc) |
||
| 29 | * @see Response::getResponseName() |
||
| 30 | */ |
||
| 31 | 1 | public function getResponseName() |
|
| 32 | { |
||
| 33 | 1 | return $this->_name; |
|
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Object property access to ArrayObject data. |
||
| 38 | */ |
||
| 39 | public function __get($property) |
||
| 40 | { |
||
| 41 | $key = $this->_transformPropertyName($property); |
||
| 42 | |||
| 43 | return isset($this[$key]) ? $this[$key] : null; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Object property access to ArrayObject data. |
||
| 48 | */ |
||
| 49 | public function __isset($property) |
||
| 50 | { |
||
| 51 | $key = $this->_transformPropertyName($property); |
||
| 52 | |||
| 53 | return isset($this[$key]); |
||
| 54 | } |
||
| 55 | |||
| 56 | // ---------------------------------------- |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Tranform underscored property name to hyphenated array key. |
||
| 60 | * |
||
| 61 | * @param string |
||
| 62 | * |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | private function _transformPropertyName($propertyName) |
||
| 68 | } |
||
| 69 | } |
||
| 70 |