* @param string $data The string to parse. This may be in any valid encoding
* @param string|null $encodingOrContentType The document encoding, or HTTP Content-Type header value, if known. If no provided encoding detection will be attempted
* @param \MensBeam\HTML\Parser\Config|null $config The configuration parameters to use, if any
*/
public static function parse(string $data, ?string $encodingOrContentType = null, ?Config $config = null): Output {
* @param \DOMElement $contextElement The context element. The fragment will be pparsed as if it is a collection of children of this element
* @param int|null $quirksMode The "quirks mode" property of the context element's document. Must be one of Parser::NO_QUIRKS_MODE, Parser::LIMITED_QUIRKS_MODE, or Parser::QUIRKS_MODE
* @param string $data The string to parse. This may be in any valid encoding
* @param string|null $encodingOrContentType The document encoding, or HTTP Content-Type header value, if known. If no provided encoding detection will be attempted
* @param \MensBeam\HTML\Parser\Config|null $config The configuration parameters to use, if any
/** Parses a string into an existing document object
*
* @param string $data The string to parse. This may be in any valid encoding
* @param \DOMDocument $document The document to parse into. Must be an instance of or derived from \DOMDocument and must be empty
* @param string|null $encodingOrContentType The document encoding, or HTTP Content-Type header value, if known. If no provided encoding detection will be attempted
* @param \MensBeam\HTML\Parser\Config|null $config The configuration parameters to use, if any
*/
public static function parseInto(string $data, \DOMDocument $document, ?string $encodingOrContentType = null, ?Config $config = null): Output {
return static::parseDocumentOrFragment($data, $encodingOrContentType, $document, null, null, $config ?? new Config);