Code Duplication    Length = 17-20 lines in 2 locations

src/Json5Decoder.php 2 locations

@@ 384-403 (lines=20) @@
381
     * To finish the block comment, we look for an ending *​/ pair of characters,
382
     * but we also watch for the end of text before the comment is terminated.
383
     */
384
    private function blockComment()
385
    {
386
        if ($this->ch !== '*') {
387
            $this->throwSyntaxError('Not a block comment');
388
        }
389
390
        do {
391
            $this->next();
392
            while ($this->ch === '*') {
393
                $this->next('*');
394
                if ($this->ch === '/') {
395
                    $this->next('/');
396
397
                    return;
398
                }
399
            }
400
        } while ($this->ch);
401
402
        $this->throwSyntaxError('Unterminated block comment');
403
    }
404
405
    /**
406
     * Skip a comment, whether inline or block-level, assuming this is one.
@@ 408-424 (lines=17) @@
405
    /**
406
     * Skip a comment, whether inline or block-level, assuming this is one.
407
     */
408
    private function comment()
409
    {
410
        // Comments always begin with a / character.
411
        if ($this->ch !== '/') {
412
            $this->throwSyntaxError('Not a comment');
413
        }
414
415
        $this->next('/');
416
417
        if ($this->ch === '/') {
418
            $this->inlineComment();
419
        } elseif ($this->ch === '*') {
420
            $this->blockComment();
421
        } else {
422
            $this->throwSyntaxError('Unrecognized comment');
423
        }
424
    }
425
426
    /**
427
     * Skip whitespace and comments.