Entities final class
Minn\Support\Entities · public/minn/src/Minn/Support/Entities.php · 82 lines
HTML special-character encoding with the reference's quote styles and its "do not double encode" rule: an ampersand that already starts a known named or numeric entity stays as it is.
Constants and properties
| private | DECODE = array ( '&' => '&', '&' => '&', '&' => '&', '<' => '<', '<' => '<', '<' => '<', '>' => '>', '>' => '>', '>' => '>', ) | |
| private | DOUBLE_QUOTES = array ( '"' => '"', '"' => '"', '"' => '"', ) | |
| private | SINGLE_QUOTES = array ( ''' => '\'', ''' => '\'', ''' => '\'', ''' => '\'', ) |
Public
| static | specialchars(string $text, string|int|false $quoteStyle, bool $doubleEncode, callable $knownEntity): string# | The reference's special-characters escaping, with its quote styles and double-encoding rule.
| ||||||
| static | decode(string $text, string|int $quoteStyle): string# | The reverse of specialchars: the five characters back, with the quote pairs the style asks for. | ||||||
| static | convertInvalid(string $text): string# | Windows-1252 numeric references rewritten as the Unicode references they meant. |
Internals 2
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | encodeStrayAmpersands(string $text, callable $knownEntity): string# | |
| private | windows1252(): array# | Decimal references 128 to 159 name Windows-1252 characters, not the C1 controls Unicode puts there; each becomes the reference to the Unicode character it meant, and a code Windows-1252 leaves unassigned is removed. Only the exact unpadded decimal spelling is touched. @return array<string, string> |
Nothing matches.