mirror of
https://github.com/cerbero90/json-parser.git
synced 2025-01-17 04:58:15 +01:00
Iterate through the original tree
This commit is contained in:
parent
ab8c10c05d
commit
54b19eb70b
@ -54,7 +54,7 @@ class Pointers implements Countable
|
||||
$pointers = [];
|
||||
|
||||
foreach ($this->pointers as $pointer) {
|
||||
foreach ($tree as $depth => $key) {
|
||||
foreach ($tree->original() as $depth => $key) {
|
||||
if (!$pointer->depthMatchesKey($depth, $key)) {
|
||||
continue 2;
|
||||
} elseif (!isset($pointers[$depth])) {
|
||||
|
14
src/Tree.php
14
src/Tree.php
@ -3,14 +3,12 @@
|
||||
namespace Cerbero\JsonParser;
|
||||
|
||||
use Cerbero\JsonParser\Pointers\Pointer;
|
||||
use IteratorAggregate;
|
||||
use Traversable;
|
||||
|
||||
/**
|
||||
* The JSON tree.
|
||||
*
|
||||
*/
|
||||
class Tree implements IteratorAggregate
|
||||
class Tree
|
||||
{
|
||||
/**
|
||||
* The original JSON tree.
|
||||
@ -135,14 +133,4 @@ class Tree implements IteratorAggregate
|
||||
|
||||
return is_string($key) ? "\"$key\"" : $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the original tree iterator
|
||||
*
|
||||
* @return Traversable
|
||||
*/
|
||||
public function getIterator(): Traversable
|
||||
{
|
||||
yield from $this->original();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user