TokenList
final class TokenList implements IteratorAggregate, Countable (View source)
Properties
| int | $length | ||
| string | $value |
Methods
Returns a token from the list
Returns whether the list contains a given token
Adds the given tokens to the list
Removes the given tokens from the list
Toggles the presence of a token in the list
Replaces a token in the list with another one
Returns whether the given token is supported
Returns the number of tokens in the list
Returns an iterator over the token list
Details
string|null
item(int $index)
Returns a token from the list
Returns a token from the list at index.
bool
contains(string $token)
Returns whether the list contains a given token
Returns whether the list contains token.
void
add(string ...$tokens)
Adds the given tokens to the list
Adds the given tokens to the list, but not any that were already present.
void
remove(string ...$tokens)
Removes the given tokens from the list
Removes the given tokens from the list, but ignores any that were not present.
bool
toggle(string $token, bool|null $force = null)
Toggles the presence of a token in the list
Toggles the presence of token in the list.
bool
replace(string $token, string $newToken)
Replaces a token in the list with another one
bool
supports(string $token)
Returns whether the given token is supported
Returns whether token is in the associated attribute's supported tokens.
int
count()
Returns the number of tokens in the list
Traversable
getIterator()
Returns an iterator over the token list