Code Duplication    Length = 16-18 lines in 2 locations

src/Internal/JsonDecodeReader.php 1 location

@@ 109-124 (lines=16) @@
106
     *
107
     * @return void
108
     */
109
    public function beginObject(): void
110
    {
111
        $this->pathIndices[$this->pathIndex++]++;
112
        $this->pathIndices[$this->pathIndex] = -1;
113
114
        if ($this->stackTypes[$this->stackSize - 1] !== JsonToken::BEGIN_OBJECT) {
115
            $this->assertionFailed(JsonToken::BEGIN_OBJECT);
116
        }
117
118
        $vars = \array_reverse(\get_object_vars($this->stack[--$this->stackSize]), true);
119
        foreach ($vars as $key => $value) {
120
            $this->updateStack($value);
121
            $this->stack[$this->stackSize] = $key;
122
            $this->stackTypes[$this->stackSize++] = JsonToken::NAME;
123
        }
124
    }
125
126
    /**
127
     * Consumes the value of the next token, asserts it's a boolean and returns it

src/Internal/JsonElementReader.php 1 location

@@ 97-114 (lines=18) @@
94
     *
95
     * @return void
96
     */
97
    public function beginObject(): void
98
    {
99
        $this->pathIndices[$this->pathIndex++]++;
100
        $this->pathIndices[$this->pathIndex] = -1;
101
102
        if ($this->stackTypes[$this->stackSize - 1] !== JsonToken::BEGIN_OBJECT) {
103
            $this->assertionFailed(JsonToken::BEGIN_OBJECT);
104
        }
105
106
        /** @var JsonObject $jsonObject */
107
        $jsonObject = $this->stack[--$this->stackSize];
108
        $vars = \array_reverse($jsonObject->getProperties(), true);
109
        foreach ($vars as $key => $value) {
110
            $this->updateStack($value);
111
            $this->stack[$this->stackSize] = $key;
112
            $this->stackTypes[$this->stackSize++] = JsonToken::NAME;
113
        }
114
    }
115
116
    /**
117
     * Consumes the value of the next token, asserts it's a boolean and returns it