Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

PHP DOM Builder API

PHP DOM Builder has been unveiled in second revision

In 2014 year PHP DOM Builder library was unveiled at the first time within the framework of Baigudin Software project. Two years have been left after that moment and today we are glad to offer the second generation that is PHP DOM Builder Revision 2.

Interface «DomBuilder\Api\Property»

Elements properties access declaration.

  • interface Api\Property

All superinterfaces:

Object

public mixed|Element data(mixed $data=NULL, string $lang=NULL);

Returns or sets some user data.

The method returns a user data of the first element or sets given data for each element.

Parameters:
mixed $data — any data.
string $lang — language key for given data.

Returns:
mixed|Element — a data of the first element or this element.

public string|Element html(string $html=NULL, string $lang=NULL);

Returns or sets a HTML content.

The method sets a HTML content for each element, and any contents which were in these elements are replaced by the new content, or returns HTML content of the first element. Note: If an element has child elements, set content is ignored and method returns HTML marks of child elements.

Parameters:
string $html — new HTML string.
string $lang — language key for given html string.

Returns:
string|Element — a current value or this element.

public string|Element key(string $key=NULL);

Returns or sets an associative string key.

The method sets the key for an element or for last added element into an elements list, or returns the key of an element or the key of last added element into an elements list.

Parameters:
string $key — a string key.

Returns:
string|Element — a key of the last element or this element.

public string tagName();

Returns a HTML tag name of the first element.

Returns:
string — a tag name.

public string|Element text(string $text=NULL, string $lang=NULL);

Returns or sets a text content.

Unlike the html method, the method converts HTML special characters of given text string to HTML entities, or returns converted child elements HTML marks. As the html method, text method ignores set text data if an element has child elements.

Parameters:
string $text — new text string.
string $lang — language key for given html string.

Returns:
string|Element — a current value or this element.

Back to class list