Completed
Push — master ( b4ff9c...fbe6de )
by Colin
01:00
created

BlockQuoteStartParser::tryStart()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 9
cts 9
cp 1
rs 9.7333
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 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