Completed
Push — master ( c68737...8a4625 )
by Colin
02:48 queued 11s
created

CommonMarkCoreExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 39

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 39
dl 0
loc 50
ccs 40
cts 40
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 47 1
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\Extension;
16
17
use League\CommonMark\Block\Parser as BlockParser;
18
use League\CommonMark\Block\Renderer as BlockRenderer;
19
use League\CommonMark\ConfigurableEnvironmentInterface;
20
use League\CommonMark\Inline\Parser as InlineParser;
21
use League\CommonMark\Inline\Processor as InlineProcessor;
22
use League\CommonMark\Inline\Renderer as InlineRenderer;
23
24
final class CommonMarkCoreExtension implements ExtensionInterface
25
{
26 1941
    public function register(ConfigurableEnvironmentInterface $environment)
27
    {
28
        $environment
29 1941
            ->addBlockParser(new BlockParser\BlockQuoteParser(),      70)
30 1941
            ->addBlockParser(new BlockParser\ATXHeadingParser(),      60)
31 1941
            ->addBlockParser(new BlockParser\FencedCodeParser(),      50)
32 1941
            ->addBlockParser(new BlockParser\HtmlBlockParser(),       40)
33 1941
            ->addBlockParser(new BlockParser\SetExtHeadingParser(),   30)
34 1941
            ->addBlockParser(new BlockParser\ThematicBreakParser(),   20)
35 1941
            ->addBlockParser(new BlockParser\ListParser(),            10)
36 1941
            ->addBlockParser(new BlockParser\IndentedCodeParser(),  -100)
37 1941
            ->addBlockParser(new BlockParser\LazyParagraphParser(), -200)
38
39 1941
            ->addInlineParser(new InlineParser\NewlineParser(),     200)
40 1941
            ->addInlineParser(new InlineParser\BacktickParser(),    150)
41 1941
            ->addInlineParser(new InlineParser\EscapableParser(),    80)
42 1941
            ->addInlineParser(new InlineParser\EntityParser(),       70)
43 1941
            ->addInlineParser(new InlineParser\EmphasisParser(),     60)
44 1941
            ->addInlineParser(new InlineParser\AutolinkParser(),     50)
45 1941
            ->addInlineParser(new InlineParser\HtmlInlineParser(),   40)
46 1941
            ->addInlineParser(new InlineParser\CloseBracketParser(), 30)
47 1941
            ->addInlineParser(new InlineParser\OpenBracketParser(),  20)
48 1941
            ->addInlineParser(new InlineParser\BangParser(),         10)
49
50 1941
            ->addInlineProcessor(new InlineProcessor\EmphasisProcessor(), 0)
51
52 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\BlockQuote',    new BlockRenderer\BlockQuoteRenderer(),    0)
53 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\Document',      new BlockRenderer\DocumentRenderer(),      0)
54 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\FencedCode',    new BlockRenderer\FencedCodeRenderer(),    0)
55 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\Heading',       new BlockRenderer\HeadingRenderer(),       0)
56 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\HtmlBlock',     new BlockRenderer\HtmlBlockRenderer(),     0)
57 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\IndentedCode',  new BlockRenderer\IndentedCodeRenderer(),  0)
58 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\ListBlock',     new BlockRenderer\ListBlockRenderer(),     0)
59 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\ListItem',      new BlockRenderer\ListItemRenderer(),      0)
60 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\Paragraph',     new BlockRenderer\ParagraphRenderer(),     0)
61 1941
            ->addBlockRenderer('League\CommonMark\Block\Element\ThematicBreak', new BlockRenderer\ThematicBreakRenderer(), 0)
62
63 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Code',       new InlineRenderer\CodeRenderer(),       0)
64 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Emphasis',   new InlineRenderer\EmphasisRenderer(),   0)
65 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\HtmlInline', new InlineRenderer\HtmlInlineRenderer(), 0)
66 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Image',      new InlineRenderer\ImageRenderer(),      0)
67 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Link',       new InlineRenderer\LinkRenderer(),       0)
68 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Newline',    new InlineRenderer\NewlineRenderer(),    0)
69 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Strong',     new InlineRenderer\StrongRenderer(),     0)
70 1941
            ->addInlineRenderer('League\CommonMark\Inline\Element\Text',       new InlineRenderer\TextRenderer(),       0)
71
        ;
72 1941
    }
73
}
74