class Renderer extends PHP

Properties

protected $params
protected string $savedLocale from  Renderer
protected array[] $attributes from  PHP
protected $dynamic {@inheritdoc}
$enableQuickRenderer {@inheritdoc}
protected string $out from  PHP
protected $quickRegexp {@inheritdoc}
protected string $quickRenderingTest from  PHP
protected $static {@inheritdoc}
protected DOMXPath $xpath from  PHP

Methods

loadXML(string $xml)

Create a return a new DOMDocument loaded with given XML

from  Renderer
string
render(string $xml)

Render an intermediate representation

from  Renderer
string
renderPlainText(string $xml)

Render an intermediate representation of plain text

from  Renderer
string
renderRichText(string $xml)

Render an intermediate representation of rich text

from  PHP
string
getParameter(string $paramName)

Get the value of a parameter

from  Renderer
array
getParameters()

Get the values of all parameters

from  Renderer
void
setParameter(string $paramName, mixed $paramValue)

Set the value of a parameter from the stylesheet

from  Renderer
void
setParameters(array $params)

Set the values of several parameters from the stylesheet

from  Renderer
void
checkUnsupported(string $xml)

Test for the presence of unsupported XML and throw an exception if found

from  Renderer
string
decodeSMP(string $str)

Decode encoded characters from the Supplementary Multilingual Plane

from  Renderer
static string
decodeEntity(array $m)

Decode a matched SGML entity

from  Renderer
void
restoreLocale()

Restore the original locale

from  Renderer
void
setLocale()

Temporarily set the locale to C

from  Renderer
void
renderNode(DOMNode $node)

Render given DOMNode

__sleep()

No description

from  PHP
void
at(DOMNode $root, string $query = null)

Render the content of given node

from  PHP
bool
canQuickRender(string $xml)

Test whether given XML can be rendered with the Quick renderer

from  PHP
void
checkTagPairContent(string $id, string $xml)

Ensure that a tag pair does not contain a start tag of itself

from  PHP
string
getParamAsXPath(string $paramName)

Return a parameter's value as an XPath expression

from  PHP
string
getQuickTextContent(string $xml)

Extract the text content from given XML

from  PHP
bool
hasNonNullValues(array $array)

Test whether given array has any non-null values

from  PHP
array
matchAttributes(string $xml)

Capture and return the attributes of an XML element

from  PHP
string
renderQuick(string $xml)

Render an intermediate representation using the Quick renderer

from  PHP
string
renderQuickCallback(array $m)

Render a string matched by the Quick renderer

from  PHP
string
renderQuickSelfClosingTag(array $m)

Render a self-closing tag using the Quick renderer

from  PHP
string
renderQuickTemplate(int $id, string $xml)

Render a string matched by the Quick renderer using a generated PHP template

void
reset()

Reset object properties that are populated during rendering

from  PHP

Details

in Renderer at line 31
protected DOMDocument loadXML(string $xml)

Create a return a new DOMDocument loaded with given XML

Parameters

string $xml

Source XML

Return Value

DOMDocument

in Renderer at line 58
string render(string $xml)

Render an intermediate representation

Parameters

string $xml

Intermediate representation

Return Value

string

Rendered result

in Renderer at line 76
protected string renderPlainText(string $xml)

Render an intermediate representation of plain text

Parameters

string $xml

Intermediate representation

Return Value

string

Rendered result

in PHP at line 284
protected string renderRichText(string $xml)

Render an intermediate representation of rich text

Parameters

string $xml

Intermediate representation

Return Value

string

Rendered result

in Renderer at line 104
string getParameter(string $paramName)

Get the value of a parameter

Parameters

string $paramName

Return Value

string

in Renderer at line 114
array getParameters()

Get the values of all parameters

Return Value

array

Associative array of parameter names and values

in Renderer at line 126
void setParameter(string $paramName, mixed $paramValue)

Set the value of a parameter from the stylesheet

Parameters

string $paramName

Parameter name

mixed $paramValue

Parameter's value

Return Value

void

in Renderer at line 137
void setParameters(array $params)

Set the values of several parameters from the stylesheet

Parameters

array $params

Associative array of [parameter name => parameter value]

Return Value

void

in Renderer at line 151
protected void checkUnsupported(string $xml)

Test for the presence of unsupported XML and throw an exception if found

Parameters

string $xml XML

Return Value

void

in Renderer at line 170
protected string decodeSMP(string $str)

Decode encoded characters from the Supplementary Multilingual Plane

Parameters

string $str

Encoded string

Return Value

string

Decoded string

in Renderer at line 186
static protected string decodeEntity(array $m)

Decode a matched SGML entity

Parameters

array $m

Captures from PCRE

Return Value

string

Decoded entity

in Renderer at line 194
protected void restoreLocale()

Restore the original locale

Return Value

void

in Renderer at line 205
protected void setLocale()

Temporarily set the locale to C

Return Value

void

at line 13
protected void renderNode(DOMNode $node)

Render given DOMNode

Parameters

DOMNode $node

Return Value

void

in PHP at line 66
__sleep()

No description

in PHP at line 80
protected void at(DOMNode $root, string $query = null)

Render the content of given node

Matches the behaviour of an xsl:apply-templates element

Parameters

DOMNode $root

Context node

string $query

XPath query used to filter which child nodes to render

Return Value

void

in PHP at line 103
protected bool canQuickRender(string $xml)

Test whether given XML can be rendered with the Quick renderer

Parameters

string $xml

Return Value

bool

in PHP at line 117
protected void checkTagPairContent(string $id, string $xml)

Ensure that a tag pair does not contain a start tag of itself

Detects malformed matches such as

Parameters

string $id
string $xml

Return Value

void

in PHP at line 131
protected string getParamAsXPath(string $paramName)

Return a parameter's value as an XPath expression

Parameters

string $paramName

Return Value

string

in PHP at line 144
protected string getQuickTextContent(string $xml)

Extract the text content from given XML

NOTE: numeric character entities are decoded beforehand, we don't need to decode them here

Parameters

string $xml

Original XML

Return Value

string

Text content, with special characters decoded

in PHP at line 155
protected bool hasNonNullValues(array $array)

Test whether given array has any non-null values

Parameters

array $array

Return Value

bool

in PHP at line 176
protected array matchAttributes(string $xml)

Capture and return the attributes of an XML element

NOTE: XML character entities are left as-is

Parameters

string $xml

Element in XML form

Return Value

array

Dictionary of [attrName => attrValue]

in PHP at line 195
protected string renderQuick(string $xml)

Render an intermediate representation using the Quick renderer

Parameters

string $xml

Intermediate representation

Return Value

string

in PHP at line 216
protected string renderQuickCallback(array $m)

Render a string matched by the Quick renderer

This stub should be overwritten by generated renderers

Parameters

array $m

Return Value

string

in PHP at line 253
protected string renderQuickSelfClosingTag(array $m)

Render a self-closing tag using the Quick renderer

Parameters

array $m

Return Value

string

at line 26
protected string renderQuickTemplate(int $id, string $xml)

Render a string matched by the Quick renderer using a generated PHP template

This stub should be overwritten by generated renderers

Parameters

int $id

Tag's ID (tag name optionally preceded by a slash)

string $xml

Tag's XML or tag pair's XML including their content

Return Value

string

Rendered template

in PHP at line 319
protected void reset()

Reset object properties that are populated during rendering

Return Value

void