CodeGenerator
Table of Contents
Methods
- __construct() : mixed
- CodeGenerator constructor.
- generate() : string|null
- Generate code
- getUniqueCheckCallback() : Closure|null
- getUniqueCheckFilter() : array<string|int, mixed>
- isCodeValid() : bool
- Returns true if validation specified for the code string field passes successfully
- setUniqueCheckCallback() : $this
- Set additional callback to check uniqueness code
- setUniqueCheckFilter() : $this
- Set an additional filter that will be taken into account when fetching data using $this->dataManager to check the uniqueness of the code
- setUseOnlyUniqueCheckCallback() : self
- setUseOnlyUniqueCheckFilter() : $this
- If true, then when checking the uniqueness of the code, only the filter set in $uniqueCheckFilter will be taken into account.
Methods
__construct()
CodeGenerator constructor.
public
__construct(string $dataManager, StringField $codeField) : mixed
Parameters
- $dataManager : string
- $codeField : StringField
Tags
generate()
Generate code
public
generate([string|null $title = null ]) : string|null
Parameters
- $title : string|null = null
Return values
string|nullgetUniqueCheckCallback()
public
getUniqueCheckCallback() : Closure|null
Return values
Closure|nullgetUniqueCheckFilter()
public
getUniqueCheckFilter() : array<string|int, mixed>
Return values
array<string|int, mixed>isCodeValid()
Returns true if validation specified for the code string field passes successfully
public
isCodeValid(string $code) : bool
Parameters
- $code : string
Tags
Return values
boolsetUniqueCheckCallback()
Set additional callback to check uniqueness code
public
setUniqueCheckCallback(Closure|null $uniqueCheckCallback) : $this
Parameters
- $uniqueCheckCallback : Closure|null
Return values
$thissetUniqueCheckFilter()
Set an additional filter that will be taken into account when fetching data using $this->dataManager to check the uniqueness of the code
public
setUniqueCheckFilter(array<string|int, mixed> $uniqueCheckFilter) : $this
Parameters
- $uniqueCheckFilter : array<string|int, mixed>
Return values
$thissetUseOnlyUniqueCheckCallback()
public
setUseOnlyUniqueCheckCallback(bool $isUse) : self
Parameters
- $isUse : bool
Return values
selfsetUseOnlyUniqueCheckFilter()
If true, then when checking the uniqueness of the code, only the filter set in $uniqueCheckFilter will be taken into account.
public
setUseOnlyUniqueCheckFilter(bool $isUse) : $this
Default $uniqueCheckFilter = []
Parameters
- $isUse : bool