Code Duplication    Length = 15-16 lines in 2 locations

src/Internal/JsonDecodeReader.php 1 location

@@ 88-102 (lines=15) @@
85
     *
86
     * @return void
87
     */
88
    public function beginArray(): void
89
    {
90
        $this->pathIndices[$this->pathIndex++]++;
91
        $this->pathIndices[$this->pathIndex] = -1;
92
93
        if ($this->stackTypes[$this->stackSize - 1] !== JsonToken::BEGIN_ARRAY) {
94
            $this->assertionFailed(JsonToken::BEGIN_ARRAY);
95
        }
96
97
        $array = $this->stack[--$this->stackSize];
98
        $size = \count($array);
99
        for ($i = $size - 1; $i >= 0; $i--) {
100
            $this->updateStack($array[$i]);
101
        }
102
    }
103
104
    /**
105
     * Consumes the next token and asserts it's the beginning of a new object

src/Internal/JsonElementReader.php 1 location

@@ 75-90 (lines=16) @@
72
     *
73
     * @return void
74
     */
75
    public function beginArray(): void
76
    {
77
        $this->pathIndices[$this->pathIndex++]++;
78
        $this->pathIndices[$this->pathIndex] = -1;
79
80
        if ($this->stackTypes[$this->stackSize - 1] !== JsonToken::BEGIN_ARRAY) {
81
            $this->assertionFailed(JsonToken::BEGIN_ARRAY);
82
        }
83
84
        /** @var JsonArray $jsonArray */
85
        $jsonArray = $this->stack[--$this->stackSize];
86
        $size = \count($jsonArray);
87
        for ($i = $size - 1; $i >= 0; $i--) {
88
            $this->updateStack($jsonArray->get($i));
89
        }
90
    }
91
92
    /**
93
     * Consumes the next token and asserts it's the beginning of a new object