| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
/*
|
|
|
6 |
* This file is part of the league/commonmark package.
|
|
|
7 |
*
|
|
|
8 |
* (c) Colin O'Dell <colinodell@gmail.com>
|
|
|
9 |
*
|
|
|
10 |
* For the full copyright and license information, please view the LICENSE
|
|
|
11 |
* file that was distributed with this source code.
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
namespace League\CommonMark\Extension\CommonMark\Parser\Block;
|
|
|
15 |
|
|
|
16 |
use League\CommonMark\Extension\CommonMark\Node\Block\ThematicBreak;
|
|
|
17 |
use League\CommonMark\Parser\Block\AbstractBlockContinueParser;
|
|
|
18 |
use League\CommonMark\Parser\Block\BlockContinue;
|
|
|
19 |
use League\CommonMark\Parser\Block\BlockContinueParserInterface;
|
|
|
20 |
use League\CommonMark\Parser\Cursor;
|
|
|
21 |
|
|
|
22 |
final class ThematicBreakParser extends AbstractBlockContinueParser
|
|
|
23 |
{
|
|
|
24 |
/** @psalm-readonly */
|
|
|
25 |
private ThematicBreak $block;
|
|
|
26 |
|
|
|
27 |
public function __construct()
|
|
|
28 |
{
|
|
|
29 |
$this->block = new ThematicBreak();
|
|
|
30 |
}
|
|
|
31 |
|
|
|
32 |
public function getBlock(): ThematicBreak
|
|
|
33 |
{
|
|
|
34 |
return $this->block;
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
public function tryContinue(Cursor $cursor, BlockContinueParserInterface $activeBlockParser): ?BlockContinue
|
|
|
38 |
{
|
|
|
39 |
// a horizontal rule can never container > 1 line, so fail to match
|
|
|
40 |
return BlockContinue::none();
|
|
|
41 |
}
|
|
|
42 |
}
|