blob: de01598f601d0f06e948ea426482b3b18f8f01a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
<?php
/*
* This file is part of the league/commonmark package.
*
* (c) Colin O'Dell <colinodell@gmail.com>
*
* Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
* - (c) John MacFarlane
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\CommonMark\Delimiter;
use League\CommonMark\Inline\Element\AbstractStringContainer;
final class Delimiter implements DelimiterInterface
{
/** @var string */
private $char;
/** @var int */
private $length;
/** @var int */
private $originalLength;
/** @var AbstractStringContainer */
private $inlineNode;
/** @var DelimiterInterface|null */
private $previous;
/** @var DelimiterInterface|null */
private $next;
/** @var bool */
private $canOpen;
/** @var bool */
private $canClose;
/** @var bool */
private $active;
/** @var int|null */
private $index;
/**
* @param string $char
* @param int $numDelims
* @param AbstractStringContainer $node
* @param bool $canOpen
* @param bool $canClose
* @param int|null $index
*/
public function __construct(string $char, int $numDelims, AbstractStringContainer $node, bool $canOpen, bool $canClose, ?int $index = null)
{
$this->char = $char;
$this->length = $numDelims;
$this->originalLength = $numDelims;
$this->inlineNode = $node;
$this->canOpen = $canOpen;
$this->canClose = $canClose;
$this->active = true;
$this->index = $index;
}
/**
* {@inheritdoc}
*/
public function canClose(): bool
{
return $this->canClose;
}
/**
* {@inheritdoc}
*/
public function setCanClose(bool $canClose)
{
$this->canClose = $canClose;
}
/**
* {@inheritdoc}
*/
public function canOpen(): bool
{
return $this->canOpen;
}
/**
* {@inheritdoc}
*/
public function isActive(): bool
{
return $this->active;
}
/**
* {@inheritdoc}
*/
public function setActive(bool $active)
{
$this->active = $active;
}
/**
* {@inheritdoc}
*/
public function getChar(): string
{
return $this->char;
}
/**
* {@inheritdoc}
*/
public function getIndex(): ?int
{
return $this->index;
}
/**
* {@inheritdoc}
*/
public function getNext(): ?DelimiterInterface
{
return $this->next;
}
/**
* {@inheritdoc}
*/
public function setNext(?DelimiterInterface $next)
{
$this->next = $next;
}
/**
* {@inheritdoc}
*/
public function getLength(): int
{
return $this->length;
}
/**
* {@inheritdoc}
*/
public function setLength(int $length)
{
$this->length = $length;
}
/**
* {@inheritdoc}
*/
public function getOriginalLength(): int
{
return $this->originalLength;
}
/**
* {@inheritdoc}
*/
public function getInlineNode(): AbstractStringContainer
{
return $this->inlineNode;
}
/**
* {@inheritdoc}
*/
public function getPrevious(): ?DelimiterInterface
{
return $this->previous;
}
/**
* {@inheritdoc}
*/
public function setPrevious(?DelimiterInterface $previous): DelimiterInterface
{
$this->previous = $previous;
return $this;
}
}
|