HtmlContentConverter
final readonly class \
Converts HTML documents, as produced by external tools or read from HTML files, to UTF-8 and splits them into title, meta data and body text.
Internal
Table of Contents
Methods
- getCharset() : string
- Extracts the charset value from the "Content-Type" meta tag.
- split() : ExtractedText
- Splits an UTF-8 HTML document into title, keywords, description and body text.
- toUtf8() : string
- Converts a document to UTF-8 and decodes HTML entities. If no charset is given, it is detected from the "Content-Type" meta tag.
Methods
getCharset()
Extracts the charset value from the "Content-Type" meta tag.
public
getCharset(string $content) : string
Parameters
- $content : string
Return values
stringsplit()
Splits an UTF-8 HTML document into title, keywords, description and body text.
public
split(string $content) : ExtractedText
The title may be prefixed with a ":" separated label, which is dropped.
Parameters
- $content : string
Return values
ExtractedTexttoUtf8()
Converts a document to UTF-8 and decodes HTML entities. If no charset is given, it is detected from the "Content-Type" meta tag.
public
toUtf8(string $content[, string $charset = '' ]) : string
Parameters
- $content : string
- $charset : string = ''