Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
32 | 3 | public function get($index, $default = null) |
|
33 | { |
||
34 | 3 | $indexes = explode('.', trim($index, '.')); |
|
35 | 3 | $payload = $this->raw; |
|
36 | 3 | $value = $default; |
|
37 | |||
38 | 3 | foreach ($indexes as $indexValue) { |
|
39 | 3 | if (!isset($payload[$indexValue])) { |
|
40 | 1 | return $default; |
|
41 | } |
||
42 | 2 | $value = $payload = $payload[$indexValue]; |
|
43 | 2 | } |
|
44 | |||
45 | 2 | return $value; |
|
46 | } |
||
47 | |||
56 |