| @@ 348-362 (lines=15) @@ | ||
| 345 | * |
|
| 346 | * @return string |
|
| 347 | */ |
|
| 348 | public function getPath(): string |
|
| 349 | { |
|
| 350 | $result = '$'; |
|
| 351 | foreach ($this->stack as $index => $item) { |
|
| 352 | if ($item instanceof ArrayIterator && isset($this->pathIndices[$index])) { |
|
| 353 | $result .= '['.$this->pathIndices[$index].']'; |
|
| 354 | } |
|
| 355 | ||
| 356 | if ($item instanceof StdClassIterator && isset($this->pathNames[$index])) { |
|
| 357 | $result .= '.'.$this->pathNames[$index]; |
|
| 358 | } |
|
| 359 | } |
|
| 360 | ||
| 361 | return $result; |
|
| 362 | } |
|
| 363 | ||
| 364 | /** |
|
| 365 | * Push an element onto the stack |
|
| @@ 352-366 (lines=15) @@ | ||
| 349 | * |
|
| 350 | * @return string |
|
| 351 | */ |
|
| 352 | public function getPath(): string |
|
| 353 | { |
|
| 354 | $result = '$'; |
|
| 355 | foreach ($this->stack as $index => $item) { |
|
| 356 | if ($item instanceof ArrayIterator && isset($this->pathIndices[$index])) { |
|
| 357 | $result .= '['.$this->pathIndices[$index].']'; |
|
| 358 | } |
|
| 359 | ||
| 360 | if ($item instanceof JsonObjectIterator && isset($this->pathNames[$index])) { |
|
| 361 | $result .= '.'.$this->pathNames[$index]; |
|
| 362 | } |
|
| 363 | } |
|
| 364 | ||
| 365 | return $result; |
|
| 366 | } |
|
| 367 | ||
| 368 | /** |
|
| 369 | * Push an element onto the stack |
|