Dom

MaplePHP HTML Dom Library

This PHP library, named MaplePHP\DTO\Format\Dom, provides functionality for working with HTML DOM elements.

Constructor

__construct(mixed $value)

  • Initializes the DOM object with the given value, ensuring it is a string or a convertible string value.

  • Parameters:

    • $value: The initial value for the DOM object.

Static Factory Method

value(mixed $value): self

  • Creates and returns a new instance of the DOM object.

  • Parameters:

    • $value: The value to set for the DOM object.

  • Returns:

    • An instance of the DOM object.

DOM Access Methods

getDom(): object

  • Retrieves the DOM object if it has been modified.

  • Returns:

    • The DOM object.

create(string $tag): object

  • Creates an HTML DOM element with some default values.

  • Parameters:

    • $tag: The HTML tag for the element.

  • Returns:

    • The created DOM element.

Properties

  • $dom: The DOM object associated with the class.

  • $str: A Str object representing the string value.

Exceptions

  • Throws an InvalidArgumentException if the input value is not a string or a convertible string value.

Last updated