class
League
/
CommonMark
/
Util
/
HtmlElement
You are viewing an older version of the documentation. For the latest, please visit 2.4 documentation.
final
HtmlElement
Implements
- Stringable
Properties
private
$tagName
Default: null
private
$attributes
array bool>
Default: []
private
$contents
Stringable Stringable[] string
Default: null
private
$selfClosing
Default: null
Methods
public
__construct ( string $tagName , array $attributes , $contents , bool $selfClosing ) : void
Parameters
-
$tagName
string
Name of the HTML tag
-
$attributes
array
|string[]|bool> Array of attributes (values should be unescaped) -
$contents
Stringable|Stringable[]|string|null
Inner contents, pre-escaped if needed
-
$selfClosing
bool
Whether the tag is self-closing
public
getTagName ( ) : void
public
getAllAttributes
(
)
:
array|bool>
public
getAttribute ( string $key ) : string|bool|null
public
setAttribute ( string $key , $value ) : void
Parameters
- $value string|string[]|bool
public
getContents ( bool $asString ) : Stringable|Stringable[]|string
public
setContents ( $contents ) : $this
Sets the inner contents of the tag (must be pre-escaped if needed)
Parameters
- $contents Stringable|Stringable[]|string
public
__toString ( ) : void
private