| @@ 59-69 (lines=11) @@ | ||
| 56 | * @param mixed $default |
|
| 57 | * @return mixed |
|
| 58 | */ |
|
| 59 | public function get($key, $default = null) |
|
| 60 | { |
|
| 61 | $current = $this->_data; |
|
| 62 | foreach (explode('.', $key) as $segment) { |
|
| 63 | if (!isset($current->{$segment})) { |
|
| 64 | return $default; |
|
| 65 | } |
|
| 66 | $current = $current->{$segment}; |
|
| 67 | } |
|
| 68 | return $current; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Check if an item or items exist in an array using "dot" notation. |
|
| @@ 77-87 (lines=11) @@ | ||
| 74 | * @param string $key |
|
| 75 | * @return mixed |
|
| 76 | */ |
|
| 77 | public function has($key) |
|
| 78 | { |
|
| 79 | $current = $this->_data; |
|
| 80 | foreach (explode('.', $key) as $segment) { |
|
| 81 | if (!isset($current->{$segment})) { |
|
| 82 | return false; |
|
| 83 | } |
|
| 84 | $current = $current->{$segment}; |
|
| 85 | } |
|
| 86 | return true; |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * Get a string representation of the object |
|