Code Duplication    Length = 16-16 lines in 2 locations

src/Internal/JsonDecodeReader.php 1 location

@@ 250-265 (lines=16) @@
247
     * @return string
248
     * @throws \Tebru\Gson\Exception\UnexpectedJsonTokenException If the next token is not NAME
249
     */
250
    public function nextName(): string
251
    {
252
        $this->expect(JsonToken::NAME);
253
254
        /** @var StdClassIterator $iterator */
255
        $iterator = $this->stack[$this->stackSize - 1];
256
        $key = $iterator->key();
257
        $value = $iterator->current();
258
        $iterator->next();
259
260
        $this->pathNames[$this->stackSize - 1] = $key;
261
262
        $this->push($value);
263
264
        return (string)$key;
265
    }
266
267
    /**
268
     * Returns an enum representing the type of the next token without consuming it

src/Internal/JsonElementReader.php 1 location

@@ 257-272 (lines=16) @@
254
     * @return string
255
     * @throws \Tebru\Gson\Exception\UnexpectedJsonTokenException If the next token is not NAME
256
     */
257
    public function nextName(): string
258
    {
259
        $this->expect(JsonToken::NAME);
260
261
        /** @var JsonObjectIterator $iterator */
262
        $iterator = $this->stack[$this->stackSize - 1];
263
        $key = $iterator->key();
264
        $value = $iterator->current();
265
        $iterator->next();
266
267
        $this->pathNames[$this->stackSize - 1] = $key;
268
269
        $this->push($value);
270
271
        return $key;
272
    }
273
274
    /**
275
     * Returns an enum representing the type of the next token without consuming it