mirror of
https://github.com/halaxa/json-machine.git
synced 2025-01-29 10:28:09 +01:00
Fixed double key yield
This commit is contained in:
parent
6b169b17b1
commit
a73654cd65
@ -120,6 +120,7 @@ class Parser implements \IteratorAggregate
|
||||
$previousToken = null;
|
||||
if ($currentLevel === $iteratorLevel) {
|
||||
$key = $token;
|
||||
$jsonBuffer = '';
|
||||
} elseif ($currentLevel < $iteratorLevel) {
|
||||
$currentPath[$currentLevel] = json_decode($token);
|
||||
}
|
||||
|
@ -15,8 +15,11 @@ class ParserTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSyntax($pathSpec, $json, $expectedResult)
|
||||
{
|
||||
$result = iterator_to_array($this->createParser($json, $pathSpec));
|
||||
$this->assertEquals($expectedResult, $result);
|
||||
$resultWithKeys = iterator_to_array($this->createParser($json, $pathSpec));
|
||||
$resultNoKeys = iterator_to_array($this->createParser($json, $pathSpec), false);
|
||||
|
||||
$this->assertEquals($expectedResult, $resultWithKeys);
|
||||
$this->assertEquals(array_values($expectedResult), $resultNoKeys);
|
||||
}
|
||||
|
||||
public function dataSyntax()
|
||||
|
Loading…
x
Reference in New Issue
Block a user