ReferralCode
in package
FinalYes
Referral code of the affiliate program: base36 of the user id plus a random suffix of {@see self::SUFFIX_LENGTH} characters, lowercase `[0-9a-z]`.
The front stores the code from /registrace?ref=<code> in the cookie self::COOKIE for
self::COOKIE_LIFETIME; the cookie is functional (only the code, no tracking) and needs no consent.
Table of Contents
Constants
- COOKIE : string = 'cc_ref'
- COOKIE_LIFETIME : string = '30 days'
- QUERY_PARAMETER : string = 'ref'
- SUFFIX_LENGTH : int = 6
Methods
- normalize() : string|null
- Trimmed lowercase code, or null when it cannot be a referral code.
Constants
COOKIE
public
string
COOKIE
= 'cc_ref'
COOKIE_LIFETIME
public
string
COOKIE_LIFETIME
= '30 days'
QUERY_PARAMETER
public
string
QUERY_PARAMETER
= 'ref'
SUFFIX_LENGTH
public
int
SUFFIX_LENGTH
= 6
Methods
normalize()
Trimmed lowercase code, or null when it cannot be a referral code.
public
static normalize(mixed $code) : string|null
Parameters
- $code : mixed