1 | <?php |
||
5 | class Text extends AbstractToken |
||
6 | { |
||
7 | /** |
||
8 | * Constructor |
||
9 | * |
||
10 | * @param Token|null $parent The parent Token |
||
11 | * @param bool $throwOnError |
||
12 | * @param string $forcedValue For when contents could be parsed but will be interpreted as TEXT instead. |
||
13 | * When forcing a value, do not call parse. |
||
14 | */ |
||
15 | 32 | public function __construct(Token $parent = null, bool $throwOnError = true, string $forcedValue = '') |
|
24 | |||
25 | 25 | public function parse(string $html) : string |
|
50 | |||
51 | 14 | public function toArray() : array |
|
60 | |||
61 | /** |
||
62 | * If whitespace exists at the start of the HTML, collapse it to a single space. |
||
63 | * |
||
64 | * @param string $html |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | 25 | private function determineStartingWhitespace(string $html) : string |
|
77 | |||
78 | /** |
||
79 | * If whitespace exists at the end of the HTML, collapse it to a single space. |
||
80 | * |
||
81 | * @param string $text |
||
82 | * |
||
83 | * @return string |
||
84 | */ |
||
85 | 21 | private function determineEndingWhitespace(string $text) : string |
|
94 | } |
||
95 |