Validators
in package
Validators for the consent. We never trust data coming from a client.
Table of Contents
Methods
- isIsoDate() : bool
- Check if the passed `date` is a valid ISO date coming from `new Date().toISOString()`.
- isValidUuid() : bool
- Check if the passed `uuid` is a valid UUID.
- sanitizeButtonClicked() : string
- Check if the passed `buttonClicked` is a string with valid characters `[a-z_]`. In general, we do not provide a set of available button names as this is done through the UI.
- sanitizeGcmConsent() : array<string|int, mixed>
- Check if the passed array contains only `string` values.
- sanitizeTcfString() : string
- Currently, the passed `tcfString` is only checked if it is a string.
- sanitizeUiView() : string
- Check if the passed `uiView` is a string and is either `initial` or `change`.
Methods
isIsoDate()
Check if the passed `date` is a valid ISO date coming from `new Date().toISOString()`.
public
static isIsoDate(string $date) : bool
Parameters
- $date : string
Return values
boolisValidUuid()
Check if the passed `uuid` is a valid UUID.
public
static isValidUuid(string $uuid) : bool
Parameters
- $uuid : string
Return values
boolsanitizeButtonClicked()
Check if the passed `buttonClicked` is a string with valid characters `[a-z_]`. In general, we do not provide a set of available button names as this is done through the UI.
public
static sanitizeButtonClicked(string $buttonClicked) : string
Parameters
- $buttonClicked : string
Return values
stringsanitizeGcmConsent()
Check if the passed array contains only `string` values.
public
static sanitizeGcmConsent(array<string|int, mixed>|string $gcmConsent) : array<string|int, mixed>
Parameters
- $gcmConsent : array<string|int, mixed>|string
Return values
array<string|int, mixed>sanitizeTcfString()
Currently, the passed `tcfString` is only checked if it is a string.
public
static sanitizeTcfString(string $tcfString) : string
Parameters
- $tcfString : string
Return values
stringsanitizeUiView()
Check if the passed `uiView` is a string and is either `initial` or `change`.
public
static sanitizeUiView(string $uiView) : string
Parameters
- $uiView : string