Skip to main content

HtmlStyleAttributeSet

Class for storing and processing HTML style attribute.


  • Full name: \TwbsHelper\View\HtmlStyleAttributeSet
  • Parent class: ArrayObject
  • This class implements: Stringable

Constants

ConstantVisibilityTypeValue
ATTRIBUTE_NAMEpublic'style'

Methods

__construct

Constructor.

public __construct(string|iterable<string,string> $styles = []): mixed

Parameters:

ParameterTypeDescription
$stylesstring|iterable<string,string>
If a string is provided, it should be a CSS style string (e.g., "color: red; font-size: 12px;").
If an iterable is provided, it should contain key-value pairs of styles.

merge

Merge styles with existing styles.

public merge(iterable<string,string> $styles): self

Parameters:

ParameterTypeDescription
$stylesiterable<string,string>

__toString

Return a string of tag attributes.

public __toString(): string

cleanAttribute

public cleanAttribute(): self