| Conditions | 6 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public function get($item = null, $default = null) |
||
| 41 | { |
||
| 42 | if (is_null($item)) { |
||
| 43 | return $default; |
||
| 44 | } |
||
| 45 | |||
| 46 | $decoded = $this->getDecodedJson(); |
||
| 47 | |||
| 48 | if (array_key_exists($item, $decoded)) { |
||
| 49 | return $decoded[$item]; |
||
| 50 | } |
||
| 51 | |||
| 52 | foreach (explode('.', $item) as $segment) { |
||
| 53 | if (! is_array($decoded) || ! array_key_exists($segment, $decoded)) { |
||
| 54 | return $default; |
||
| 55 | } |
||
| 56 | |||
| 57 | $decoded = $decoded[$segment]; |
||
| 58 | } |
||
| 59 | |||
| 60 | return $decoded; |
||
| 61 | } |
||
| 90 |