protected function insertValue($value): void
    {
        // Grab the top item from the stack that we're currently parsing.
        $currentItem = array_pop($this->stack);

        // Examine the current item, and then:
        //   - if it's an object, associate the newly-parsed value with the most recent key
        //   - if it's an array, push the newly-parsed value to the array
        if ('object' === $currentItem['type']) {
            $currentItem['value'][array_pop($this->keys)] = $value;
        } else {
            $currentItem['value'][] = $value;
        }

        // Replace the current item on the stack.
        $this->stack[] = $currentItem;
    }
protected function insertValue($value): void
    {
        // Grab the top item from the stack that we're currently parsing.
        $currentItem = array_pop($this->stack);

        // Examine the current item, and then:
        //   - if it's an object, associate the newly-parsed value with the most recent key
        //   - if it's an array, push the newly-parsed value to the array
        if ('object' === $currentItem['type']) {
            $currentItem['value'][array_pop($this->keys)] = $value;
        } else {
            $currentItem['value'][] = $value;
        }

        // Replace the current item on the stack.
        $this->stack[] = $currentItem;
    }
protected function insertValue ( $ value ) : void { // Grab the top item from the stack that we're currently parsing. $ currentItem = array_pop ( $ this -> stack ) ; // Examine the current item, and then: //   - if it's an object, associate the newly-parsed value with the most recent key //   - if it's an array, push the newly-parsed value to the array if ( 'object' === $ currentItem [ 'type' ] ) { $ currentItem [ 'value' ] [ array_pop ( $ this -> keys ) ] = $ value ; } else { $ currentItem [ 'value' ] [ ] = $ value ; } // Replace the current item on the stack. $ this -> stack [ ] = $ currentItem ; }
based on whether that value is an array or an object.
based on whether that value is an array or an object .