Code Duplication    Length = 14-14 lines in 2 locations

src/Internal/JsonDecodeReader.php 1 location

@@ 402-415 (lines=14) @@
399
     * @param string $expectedToken
400
     * @throws UnexpectedJsonTokenException
401
     */
402
    private function expect(string $expectedToken)
403
    {
404
        if ($this->peek() === $expectedToken) {
405
            return;
406
        }
407
408
        // increment the path index because exceptions are thrown before this value is increased. We
409
        // want to display the current index that has a problem.
410
        $this->incrementPathIndex();
411
412
        throw new UnexpectedJsonTokenException(
413
            sprintf('Expected "%s", but found "%s" at "%s"', $expectedToken, $this->peek(), $this->getPath())
414
        );
415
    }
416
417
    /**
418
     * Increment the path index. This should be called any time a new value is parsed.

src/Internal/JsonElementReader.php 1 location

@@ 406-419 (lines=14) @@
403
     * @param string $expectedToken
404
     * @throws UnexpectedJsonTokenException
405
     */
406
    private function expect(string $expectedToken)
407
    {
408
        if ($this->peek() === $expectedToken) {
409
            return;
410
        }
411
412
        // increment the path index because exceptions are thrown before this value is increased. We
413
        // want to display the current index that has a problem.
414
        $this->incrementPathIndex();
415
416
        throw new UnexpectedJsonTokenException(
417
            sprintf('Expected "%s", but found "%s" at "%s"', $expectedToken, $this->peek(), $this->getPath())
418
        );
419
    }
420
421
    /**
422
     * Increment the path index. This should be called any time a new value is parsed.