| @@ 213-227 (lines=15) @@ | ||
| 210 | * |
|
| 211 | * @return string |
|
| 212 | */ |
|
| 213 | public function getPath(): string |
|
| 214 | { |
|
| 215 | $result = '$'; |
|
| 216 | foreach ($this->stack as $index => $item) { |
|
| 217 | if ($item instanceof ArrayIterator && isset($this->pathIndices[$index])) { |
|
| 218 | $result .= '['.$this->pathIndices[$index].']'; |
|
| 219 | } |
|
| 220 | ||
| 221 | if ($item instanceof StdClassIterator && isset($this->pathNames[$index])) { |
|
| 222 | $result .= '.'.$this->pathNames[$index]; |
|
| 223 | } |
|
| 224 | } |
|
| 225 | ||
| 226 | return $result; |
|
| 227 | } |
|
| 228 | ||
| 229 | /** |
|
| 230 | * Push an element onto the stack |
|
| @@ 216-230 (lines=15) @@ | ||
| 213 | * |
|
| 214 | * @return string |
|
| 215 | */ |
|
| 216 | public function getPath(): string |
|
| 217 | { |
|
| 218 | $result = '$'; |
|
| 219 | foreach ($this->stack as $index => $item) { |
|
| 220 | if ($item instanceof ArrayIterator && isset($this->pathIndices[$index])) { |
|
| 221 | $result .= '['.$this->pathIndices[$index].']'; |
|
| 222 | } |
|
| 223 | ||
| 224 | if ($item instanceof JsonObjectIterator && isset($this->pathNames[$index])) { |
|
| 225 | $result .= '.'.$this->pathNames[$index]; |
|
| 226 | } |
|
| 227 | } |
|
| 228 | ||
| 229 | return $result; |
|
| 230 | } |
|
| 231 | ||
| 232 | /** |
|
| 233 | * Push an element onto the stack |
|