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
|
|
|
{ |
24
|
|
|
private $coreProcessor; |
25
|
|
|
|
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
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* {@inheritdoc} |
34
|
|
|
*/ |
35
|
|
|
public function getOpeningCharacter(): string |
36
|
|
|
{ |
37
|
|
|
return $this->coreProcessor->getOpeningCharacter(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* {@inheritdoc} |
42
|
|
|
*/ |
43
|
|
|
public function getClosingCharacter(): string |
44
|
|
|
{ |
45
|
|
|
return $this->coreProcessor->getClosingCharacter(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* {@inheritdoc} |
50
|
|
|
*/ |
51
|
|
|
public function getMinLength(): int |
52
|
|
|
{ |
53
|
|
|
return $this->coreProcessor->getMinLength(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* {@inheritdoc} |
58
|
|
|
*/ |
59
|
|
|
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int |
60
|
|
|
{ |
61
|
|
|
return $this->coreProcessor->getDelimiterUse($opener, $closer); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* {@inheritdoc} |
66
|
|
|
*/ |
67
|
|
|
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse) |
68
|
|
|
{ |
69
|
|
|
return $this->coreProcessor->process($opener, $closer, $delimiterUse); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
If you suppress an error, we recommend checking for the error condition explicitly: