ApiOpenStudio PHPDoc

ConvertHtml
in package

Class ConvertHtml

Class to convert HTML to an array, object or JSON.

The

Table of Contents

$attributePrefix  : string
$htmlTextTag  : string
__construct()  : mixed
arrayToHtml()  : string
Convert the output array format from this class into a HTML string.
htmlToArray()  : array<string|int, mixed>
Convert a valid HTML document string into an array.
htmlToJson()  : string
Convert a valid HTML document string into an object.
htmlToXml()  : string
Convert a valid HTML document string into an xml string.
arrayToDomDocument()  : DOMDocument
Return a DOM Document defined in an array.
domElementToArray()  : array<string|int, mixed>
Convert a DOM element to an array of attributes and children.
generateElement()  : DOMElement
Generate a DOM element with its value, attributes and all of its children.
getAttributes()  : array<string|int, mixed>
Return an array of attributes for a DOM element.
getChildren()  : array<string|int, mixed>
Return an array of children for a DOM element.
getText()  : string
Return raw text for a DOM element.

Properties

Methods

__construct()

public __construct([string $attributePrefix = '_' ][, string $htmlTextTag = '#text' ]) : mixed
Parameters
$attributePrefix : string = '_'
$htmlTextTag : string = '#text'
Return values
mixed

arrayToHtml()

Convert the output array format from this class into a HTML string.

public arrayToHtml(array<string|int, mixed> $definition) : string
Parameters
$definition : array<string|int, mixed>
Return values
string

htmlToArray()

Convert a valid HTML document string into an array.

public htmlToArray(string $html) : array<string|int, mixed>

This is an array format that maintains the element order and no data loss.

Parameters
$html : string
Return values
array<string|int, mixed>

htmlToJson()

Convert a valid HTML document string into an object.

public htmlToJson(string $html) : string
Parameters
$html : string
Return values
string

htmlToXml()

Convert a valid HTML document string into an xml string.

public htmlToXml(string $html) : string
Parameters
$html : string
Return values
string

arrayToDomDocument()

Return a DOM Document defined in an array.

protected arrayToDomDocument(array<string|int, mixed> $definition) : DOMDocument
Parameters
$definition : array<string|int, mixed>
Return values
DOMDocument

domElementToArray()

Convert a DOM element to an array of attributes and children.

protected domElementToArray(DOMElement $element) : array<string|int, mixed>
Parameters
$element : DOMElement
Return values
array<string|int, mixed>

generateElement()

Generate a DOM element with its value, attributes and all of its children.

protected generateElement(DOMDocument &$dom, string $elementName, array<string|int, mixed> $definition) : DOMElement
Parameters
$dom : DOMDocument
$elementName : string
$definition : array<string|int, mixed>
Return values
DOMElement

getAttributes()

Return an array of attributes for a DOM element.

protected getAttributes(DOMElement $element) : array<string|int, mixed>
Parameters
$element : DOMElement
Return values
array<string|int, mixed>

getChildren()

Return an array of children for a DOM element.

protected getChildren(DOMElement $element) : array<string|int, mixed>
Parameters
$element : DOMElement
Return values
array<string|int, mixed>

getText()

Return raw text for a DOM element.

protected getText(DOMElement $element) : string
Parameters
$element : DOMElement
Return values
string

Search results