The Dom\TokenList class

Introduction

Represents a set of tokens in an attribute (e.g. class names).

Class synopsis

final Dom\TokenList
implements IteratorAggregate Countable
/* Properties */
public readonly int $length;
public string $value;
/* Methods */
public void add(string ...$tokens)
public bool contains(string $token)
public int count()
public Iterator getIterator()
public stringnull item(int $index)
public void remove(string ...$tokens)
public bool replace(string $token, string $newToken)
public bool supports(string $token)
public bool toggle(string $token, boolnull $force = null)

Properties

length
The number of tokens.
value
The value of the attribute linked to this object.

Notes

Note: The DOM extension uses UTF-8 encoding when working with methods or properties. The parser methods auto-detect the encoding or allow the caller to specify an encoding.

Note: Tokens in the list can be accessed by array syntax.

Table of Contents