BlockQuoteParser   A
last analyzed

Coupling/Cohesion

Components 0
Dependencies 4

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 27
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 18 3
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\BlockQuote;
18
use League\CommonMark\ContextInterface;
19
use League\CommonMark\Cursor;
20
21
class BlockQuoteParser extends AbstractBlockParser
22
{
23
    /**
24
     * @param ContextInterface $context
25
     * @param Cursor           $cursor
26
     *
27
     * @return bool
28
     */
29 1932
    public function parse(ContextInterface $context, Cursor $cursor)
30
    {
31 1932
        if ($cursor->isIndented()) {
32 180
            return false;
33
        }
34
35 1881
        if ($cursor->getNextNonSpaceCharacter() !== '>') {
36 1875
            return false;
37
        }
38
39 135
        $cursor->advanceToNextNonSpaceOrTab();
40 135
        $cursor->advance();
41 135
        $cursor->advanceBySpaceOrTab();
42
43 135
        $context->addBlock(new BlockQuote());
44
45 135
        return true;
46
    }
47
}
48