| Total Complexity | 6 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | class Mailcode_Parser_Statement_Tokenizer_Token_StringLiteral extends Mailcode_Parser_Statement_Tokenizer_Token implements Mailcode_Parser_Statement_Tokenizer_ValueInterface |
||
| 24 | { |
||
| 25 | private string $text; |
||
| 26 | |||
| 27 | protected function init() : void |
||
| 28 | { |
||
| 29 | $this->setText($this->stripQuotes($this->matchedText)); |
||
| 30 | } |
||
| 31 | |||
| 32 | private function stripQuotes(string $text) : string |
||
| 33 | { |
||
| 34 | return trim($text, '"'); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Retrieves the text with the surrounding quotes, |
||
| 39 | * and special characters escaped for Mailcode. |
||
| 40 | * |
||
| 41 | * @return string |
||
| 42 | */ |
||
| 43 | public function getNormalized() : string |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Retrieves the text with the surrounding quotes. |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getValue() : string |
||
| 53 | { |
||
| 54 | return $this->getNormalized(); |
||
| 55 | } |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Retrieves the text without the surrounding quotes, |
||
| 59 | * and special Mailcode characters not escaped. |
||
| 60 | * |
||
| 61 | * @return string |
||
| 62 | */ |
||
| 63 | public function getText() : string |
||
| 64 | { |
||
| 65 | return SpecialChars::decode($this->text); |
||
| 66 | } |
||
| 67 | |||
| 68 | public function setText(string $text) : self |
||
| 74 | } |
||
| 75 | } |
||
| 76 |