Copied!
CloneableFinalInstantiable
Methods
public __construct(string $tagName, array $attributes = [], $contents = '', bool $selfClosing = false)
 
  • param string $tagName Name of the HTML tag
  • param array<string,string|string[]|bool> $attributes Array of attributes (values should be unescaped)
  • param \Stringable|\Stringable[]|string|null $contents Inner contents, pre-escaped if needed
  • param bool $selfClosing Whether the tag is self-closing
public __toString() : string
 
  • psalm-immutable
public getAllAttributes() : array
 
  • return array<string,string|bool>
  • psalm-immutable
public getAttribute(string $key)
 
  • return string|bool|null
  • psalm-immutable
public getContents(bool $asString = true)
 
  • return \Stringable|\Stringable[]|string
  • psalm-immutable
public getTagName() : string
 
  • psalm-immutable
public setAttribute(string $key, $value = true) : self
 
  • param string|string[]|bool $value
public setContents( $contents) : self
 

Sets the inner contents of the tag (must be pre-escaped if needed)

  • param \Stringable|\Stringable[]|string $contents
  • return $this
Properties
private array $attributes = []
 
  • var array<string,string|bool>
private $contents = NULL
 
  • var \Stringable|\Stringable[]|string
private bool $selfClosing
 
  • psalm-readonly
private string $tagName
 
  • psalm-readonly
Methods
private getContentsAsString() : string
 
  • psalm-immutable
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration