HtmlWorker
API still might change
Attributes
- #[Autoconfigure]
- $public: true
Table of Contents
Constants
- REMOVE_ATTR_ON_FAILURE = 2
- Removes corresponding attribute in case there's a failure e.g. `<a href="t3://!!INVALID!!">value</a>` --> `<a>value</a>`
- REMOVE_ENCLOSURE_ON_FAILURE = 4
- Removes corresponding enclosure in case there's a failure e.g. `<a href="t3://!!INVALID!!">value</a>` --> `value`
- REMOVE_TAG_ON_FAILURE = 1
- Removes corresponding tag in case there's a failure e.g. `<a href="t3://!!INVALID!!">value</a>` --> ``
Properties
- $document : DOMDocument|null
- $linkFactory : LinkFactory
- $mount : DOMNode|null
- $parser : HTML5
Methods
- __construct() : mixed
- __toString() : string
- addNonceAttribute() : self
- parse() : self
- transformUri() : self
- mountFragment() : DOMNode
- onTransformUriFailure() : void
- parseSelector() : array<string|int, array{node: string, attr: string}>
Constants
REMOVE_ATTR_ON_FAILURE
Removes corresponding attribute in case there's a failure e.g. `<a href="t3://!!INVALID!!">value</a>` --> `<a>value</a>`
public
mixed
REMOVE_ATTR_ON_FAILURE
= 2
REMOVE_ENCLOSURE_ON_FAILURE
Removes corresponding enclosure in case there's a failure e.g. `<a href="t3://!!INVALID!!">value</a>` --> `value`
public
mixed
REMOVE_ENCLOSURE_ON_FAILURE
= 4
REMOVE_TAG_ON_FAILURE
Removes corresponding tag in case there's a failure e.g. `<a href="t3://!!INVALID!!">value</a>` --> ``
public
mixed
REMOVE_TAG_ON_FAILURE
= 1
Properties
$document
protected
DOMDocument|null
$document
= null
$linkFactory read-only
protected
LinkFactory
$linkFactory
$mount
protected
DOMNode|null
$mount
= null
$parser read-only
protected
HTML5
$parser
Methods
__construct()
public
__construct(LinkFactory $linkFactory, HTML5 $parser) : mixed
Parameters
- $linkFactory : LinkFactory
- $parser : HTML5
__toString()
public
__toString() : string
Return values
stringaddNonceAttribute()
public
addNonceAttribute(string|ConsumableNonce $nonce, string ...$nodeNames) : self
Parameters
- $nonce : string|ConsumableNonce
-
none value to be added
- $nodeNames : string
-
element node names to be processed (e.g.
style
)
Return values
selfparse()
public
parse(string $html) : self
Parameters
- $html : string
Return values
selftransformUri()
public
transformUri(string $selector[, int $flags = 0 ]) : self
Parameters
- $selector : string
- $flags : int = 0
Return values
selfmountFragment()
protected
mountFragment(DOMDocumentFragment $fragment) : DOMNode
Parameters
- $fragment : DOMDocumentFragment
Return values
DOMNodeonTransformUriFailure()
protected
onTransformUriFailure(DOMElement $element, array{node: string, attr: string} $subject, int $flags) : void
Parameters
- $element : DOMElement
-
current element encountered failure
- $subject : array{node: string, attr: string}
-
node-attr combination
- $flags : int
parseSelector()
protected
parseSelector(string $selector) : array<string|int, array{node: string, attr: string}>
Parameters
- $selector : string