Documentation

HtmlElement
in package

Table of Contents

$attributes  : array<string|int, string>
$contents  : HtmlElement|array<string|int, HtmlElement>|string
$selfClosing  : bool
$tagName  : string
__construct()  : mixed
__toString()  : string
getAllAttributes()  : array<string|int, string>
getAttribute()  : string|null
getContents()  : HtmlElement|array<string|int, HtmlElement>|string
getTagName()  : string
setAttribute()  : self
setContents()  : $this
Sets the inner contents of the tag (must be pre-escaped if needed)
getContentsAsString()  : string

Properties

$attributes

protected array<string|int, string> $attributes = []

Methods

__construct()

public __construct(string $tagName[, array<string|int, string> $attributes = [] ][, HtmlElement|array<string|int, HtmlElement>|string|null $contents = '' ][, bool $selfClosing = false ]) : mixed
Parameters
$tagName : string

Name of the HTML tag

$attributes : array<string|int, string> = []

Array of attributes (values should be unescaped)

$contents : HtmlElement|array<string|int, HtmlElement>|string|null = ''

Inner contents, pre-escaped if needed

$selfClosing : bool = false

Whether the tag is self-closing

Return values
mixed

__toString()

public __toString() : string
Return values
string

getAllAttributes()

public getAllAttributes() : array<string|int, string>
Return values
array<string|int, string>

getAttribute()

public getAttribute(string $key) : string|null
Parameters
$key : string
Return values
string|null

getTagName()

public getTagName() : string
Return values
string

setAttribute()

public setAttribute(string $key, string $value) : self
Parameters
$key : string
$value : string
Return values
self

getContentsAsString()

private getContentsAsString() : string
Return values
string

Search results