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.

FencedCodeRenderer   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 3

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 33
ccs 17
cts 17
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B render() 0 23 6
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\Renderer;
16
17
use League\CommonMark\Block\Element\AbstractBlock;
18
use League\CommonMark\Block\Element\FencedCode;
19
use League\CommonMark\ElementRendererInterface;
20
use League\CommonMark\HtmlElement;
21
22
class FencedCodeRenderer implements BlockRendererInterface
23
{
24
    /**
25
     * @param FencedCode               $block
26
     * @param ElementRendererInterface $htmlRenderer
27
     * @param bool                     $inTightList
28
     *
29
     * @return HtmlElement
30
     */
31 111
    public function render(AbstractBlock $block, ElementRendererInterface $htmlRenderer, $inTightList = false)
32
    {
33 111
        if (!($block instanceof FencedCode)) {
34 3
            throw new \InvalidArgumentException('Incompatible block type: ' . get_class($block));
35
        }
36
37 108
        $attrs = [];
38 108
        foreach ($block->getData('attributes', []) as $key => $value) {
39 6
            $attrs[$key] = $htmlRenderer->escape($value, true);
40 108
        }
41
42 108
        $infoWords = $block->getInfoWords();
43 108
        if (count($infoWords) !== 0 && strlen($infoWords[0]) !== 0) {
44 18
            $attrs['class'] = isset($attrs['class']) ? $attrs['class'] . ' ' : '';
45 18
            $attrs['class'] .= 'language-' . $htmlRenderer->escape($infoWords[0], true);
46 18
        }
47
48 108
        return new HtmlElement(
49 108
            'pre',
50 108
            [],
51 108
            new HtmlElement('code', $attrs, $htmlRenderer->escape($block->getStringContent()))
52 108
        );
53
    }
54
}
55