Code Duplication    Length = 17-20 lines in 2 locations

src/Json5Decoder.php 2 locations

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