| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | public function get($attribute) |
||
| 30 | { |
||
| 31 | if ($attribute === null) { |
||
|
|
|||
| 32 | return new Attribute($attribute); |
||
| 33 | } |
||
| 34 | |||
| 35 | if (isset($this->data[$attribute])) { |
||
| 36 | return new Attribute($attribute, $this->data[$attribute]); |
||
| 37 | } |
||
| 38 | |||
| 39 | $segments = explode('.', $attribute); |
||
| 40 | $data = null; |
||
| 41 | |||
| 42 | foreach ($segments as $segment) { |
||
| 43 | if (!array_key_exists($segment, $this->data)) { |
||
| 44 | return new Attribute($attribute); |
||
| 45 | } |
||
| 46 | |||
| 47 | $data = $this->data[$segment]; |
||
| 48 | } |
||
| 49 | |||
| 50 | return new Attribute($attribute, $data); |
||
| 51 | } |
||
| 53 |