class TokenCollection

Methods

__construct()

No description

add(Token $newToken)

Adds a Token object to this collection. If the token already exists the token will be merged with the existing one

bool
exists(Token $token, string[] $requiredLanguages = false)

Returns true if the passed Token object exists. If a requiredLanguage is passed the token must also have a matching translation set

get(string $tokenId)

Returns the Token for the passed Token ID

Token[]
getTokens()

Returns an array with all token objects in this collection

$this
merge(TokenCollection $collection)

Merges the passed TokenCollection into this collection. If the token already exists the tokens will be merged.

$this
mergeMany(array $collections)

Merges an array with multiple TokenCollections into this collection

setDomain(string $domain)

Sets the passed domain for all Tokens in this collection

Details

at line 12
__construct()

No description

at line 21
add(Token $newToken)

Adds a Token object to this collection. If the token already exists the token will be merged with the existing one

Parameters

Token $newToken

at line 91
bool exists(Token $token, string[] $requiredLanguages = false)

Returns true if the passed Token object exists. If a requiredLanguage is passed the token must also have a matching translation set

Parameters

Token $token

Token Object

string[] $requiredLanguages

Array with required locales. All passed locales must be present.

Return Value

bool

at line 36
Token get(string $tokenId)

Returns the Token for the passed Token ID

Parameters

string $tokenId

Return Value

Token

at line 57
Token[] getTokens()

Returns an array with all token objects in this collection

Return Value

Token[]

at line 66
$this merge(TokenCollection $collection)

Merges the passed TokenCollection into this collection. If the token already exists the tokens will be merged.

Parameters

TokenCollection $collection

Return Value

$this

at line 78
$this mergeMany(array $collections)

Merges an array with multiple TokenCollections into this collection

Parameters

array $collections

Return Value

$this

at line 44
setDomain(string $domain)

Sets the passed domain for all Tokens in this collection

Parameters

string $domain