GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

HtmlBlockParser   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 5

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 5
dl 0
loc 43
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
C parse() 0 34 7
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
9
 *  - (c) John MacFarlane
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace League\CommonMark\Block\Parser;
16
17
use League\CommonMark\Block\Element\HtmlBlock;
18
use League\CommonMark\Block\Element\Paragraph;
19
use League\CommonMark\ContextInterface;
20
use League\CommonMark\Cursor;
21
use League\CommonMark\Util\RegexHelper;
22
23
class HtmlBlockParser extends AbstractBlockParser
24
{
25
    /**
26
     * @param ContextInterface $context
27
     * @param Cursor           $cursor
28
     *
29
     * @return bool
30
     */
31 1797
    public function parse(ContextInterface $context, Cursor $cursor)
32
    {
33 1797
        if ($cursor->isIndented()) {
34 180
            return false;
35
        }
36
37 1740
        if ($cursor->getFirstNonSpaceCharacter() !== '<') {
38 1581
            return false;
39
        }
40
41 273
        $savedState = $cursor->saveState();
42
43 273
        $cursor->advanceToFirstNonSpace();
44 273
        $line = $cursor->getRemainder();
45
46 273
        for ($blockType = 1; $blockType <= 7; $blockType++) {
47 273
            $match = RegexHelper::matchAt(
48 273
                RegexHelper::getHtmlBlockOpenRegex($blockType),
49
                $line
50 273
            );
51
52 273
            if ($match !== null && ($blockType < 7 || !($context->getContainer() instanceof Paragraph))) {
53 153
                $cursor->restoreState($savedState);
54 153
                $context->addBlock(new HtmlBlock($blockType));
55 153
                $context->setBlocksParsed(true);
56
57 153
                return true;
58
            }
59 255
        }
60
61 126
        $cursor->restoreState($savedState);
62
63 126
        return false;
64
    }
65
}
66