|
@@ 54-65 (lines=12) @@
|
| 51 |
|
* @param string $key The index to fetch in dot notation |
| 52 |
|
* @return mixed |
| 53 |
|
*/ |
| 54 |
|
public function get($key) |
| 55 |
|
{ |
| 56 |
|
$index = explode('.', $key); |
| 57 |
|
$ret = self::getValue($this->item, $index, true, $err); |
| 58 |
|
|
| 59 |
|
if ($err) { |
| 60 |
|
$invalidPath = join('.', array_slice($index, 0, -1 * $err->incomplete)); |
| 61 |
|
trigger_error("Unable to get '$key': '$invalidPath' is a {$err->var}", E_USER_WARNING); |
| 62 |
|
} // @codeCoverageIgnore |
| 63 |
|
|
| 64 |
|
return $ret; |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
/** |
| 68 |
|
* Navigate through the item and get the value |
|
@@ 199-210 (lines=12) @@
|
| 196 |
|
* @param string $key The index to fetch in dot notation |
| 197 |
|
* @return object|array |
| 198 |
|
*/ |
| 199 |
|
public function remove($key) |
| 200 |
|
{ |
| 201 |
|
$index = explode('.', $key); |
| 202 |
|
self::removeValue($this->item, $index, $err); |
| 203 |
|
|
| 204 |
|
if ($err) { |
| 205 |
|
$invalidPath = join('.', array_slice($index, 0, -1 * $err->incomplete)); |
| 206 |
|
trigger_error("Unable to remove '$key': '$invalidPath' is a {$err->var}", E_USER_WARNING); |
| 207 |
|
} // @codeCoverageIgnore |
| 208 |
|
|
| 209 |
|
return $this->item; |
| 210 |
|
} |
| 211 |
|
|
| 212 |
|
/** |
| 213 |
|
* Navigate through the item and remove the value |