| @@ 79-85 (lines=7) @@ | ||
| 76 | * |
|
| 77 | * @return void |
|
| 78 | */ |
|
| 79 | public function set(string $path, $value = null) |
|
| 80 | { |
|
| 81 | $keys = $this->parsePath($path); |
|
| 82 | $last = array_pop($keys); |
|
| 83 | $node =& $this->getNodeReference($keys); |
|
| 84 | $node[$last] = $value; |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * Remove a path if it exists. |
|
| @@ 94-102 (lines=9) @@ | ||
| 91 | * |
|
| 92 | * @return void |
|
| 93 | */ |
|
| 94 | public function remove(string $pattern) |
|
| 95 | { |
|
| 96 | foreach ($this->glob($pattern) as $path) { |
|
| 97 | $keys = $this->parsePath($path); |
|
| 98 | $last = array_pop($keys); |
|
| 99 | $node =& $this->getNodeReference($keys); |
|
| 100 | unset($node[$last]); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||
| 104 | /** |
|
| 105 | * Find paths that match a pattern. |
|