|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the league/commonmark-ext-strikethrough package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Colin O'Dell <[email protected]> and uAfrica.com (http://uafrica.com) |
|
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\Ext\Strikethrough; |
|
13
|
|
|
|
|
14
|
|
|
use League\CommonMark\Delimiter\DelimiterInterface; |
|
15
|
|
|
use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface; |
|
16
|
|
|
use League\CommonMark\Extension\Strikethrough\StrikethroughDelimiterProcessor as CoreProcessor; |
|
17
|
|
|
use League\CommonMark\Inline\Element\AbstractStringContainer; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @deprecated The league/commonmark-ext-strikethrough extension is now deprecated. All functionality has been moved into league/commonmark 1.3+, so use that instead. |
|
21
|
|
|
*/ |
|
22
|
|
|
final class StrikethroughDelimiterProcessor implements DelimiterProcessorInterface |
|
23
|
51 |
|
{ |
|
24
|
|
|
private $coreProcessor; |
|
25
|
51 |
|
|
|
26
|
|
|
public function __construct() |
|
27
|
|
|
{ |
|
28
|
|
|
@trigger_error(sprintf('league/commonmark-ext-strikethrough is deprecated; use %s from league/commonmark 1.3+ instead', CoreProcessor::class), E_USER_DEPRECATED); |
|
|
|
|
|
|
29
|
|
|
$this->coreProcessor = new CoreProcessor(); |
|
30
|
|
|
} |
|
31
|
51 |
|
|
|
32
|
|
|
/** |
|
33
|
51 |
|
* {@inheritdoc} |
|
34
|
|
|
*/ |
|
35
|
|
|
public function getOpeningCharacter(): string |
|
36
|
|
|
{ |
|
37
|
|
|
return $this->coreProcessor->getOpeningCharacter(); |
|
38
|
|
|
} |
|
39
|
48 |
|
|
|
40
|
|
|
/** |
|
41
|
48 |
|
* {@inheritdoc} |
|
42
|
|
|
*/ |
|
43
|
|
|
public function getClosingCharacter(): string |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->coreProcessor->getClosingCharacter(); |
|
46
|
|
|
} |
|
47
|
30 |
|
|
|
48
|
|
|
/** |
|
49
|
30 |
|
* {@inheritdoc} |
|
50
|
|
|
*/ |
|
51
|
30 |
|
public function getMinLength(): int |
|
52
|
|
|
{ |
|
53
|
|
|
return $this->coreProcessor->getMinLength(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
30 |
|
* {@inheritdoc} |
|
58
|
|
|
*/ |
|
59
|
30 |
|
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int |
|
60
|
|
|
{ |
|
61
|
30 |
|
return $this->coreProcessor->getDelimiterUse($opener, $closer); |
|
62
|
30 |
|
} |
|
63
|
30 |
|
|
|
64
|
30 |
|
/** |
|
65
|
30 |
|
* {@inheritdoc} |
|
66
|
|
|
*/ |
|
67
|
|
|
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) |
|
68
|
30 |
|
{ |
|
69
|
30 |
|
return $this->coreProcessor->process($opener, $closer, $delimiterUse); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|
If you suppress an error, we recommend checking for the error condition explicitly: