Appearance
Attributes
php
final readonly class KMark\AttributesThe id and the CSS classes that a "{#id .class}" block sets on an element.
Source: src/Attributes.php
Methods
__construct()
php
public function __construct(string $id = '', array $classes = [])extract()
php
public static function extract(string $text): arrayTakes the "{#id .class}" block off the end of a text. If the braces hold anything else than names with a "#" or a ".", they stay in the text.
Returns array{string, self} the text and the attributes
fromList()
php
public static function fromList(string $names): selfThe attributes of a list such as "#id .one .two", or null when it is not one.
merge()
php
public function merge(self $other): selfKeeps the first id and gathers the classes.
render()
php
public function render(): stringThe attributes, ready to be written in a tag.