Completed
Push — refactor-parsing ( adbb6b...fbe6de )
by Colin
08:21 queued 07:01
created

BlockQuoteStartParser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A tryStart() 0 16 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
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace League\CommonMark\Extension\CommonMark\Parser\Block;
13
14
use League\CommonMark\Parser\Block\BlockStart;
15
use League\CommonMark\Parser\Block\BlockStartParserInterface;
16
use League\CommonMark\Parser\Cursor;
17
use League\CommonMark\Parser\MarkdownParserStateInterface;
18
19
final class BlockQuoteStartParser implements BlockStartParserInterface
20
{
21 2106
    public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart
22
    {
23 2106
        if ($cursor->isIndented()) {
24 183
            return BlockStart::none();
25
        }
26
27 2022
        if ($cursor->getNextNonSpaceCharacter() !== '>') {
28 1959
            return BlockStart::none();
29
        }
30
31 147
        $cursor->advanceToNextNonSpaceOrTab();
32 147
        $cursor->advanceBy(1);
33 147
        $cursor->advanceBySpaceOrTab();
34
35 147
        return BlockStart::of(new BlockQuoteParser())->at($cursor);
36
    }
37
}
38