Uuid
extends Rule
in package
Uuid validation rule.Check if value is valid uuid.
Table of Contents
Constants
- BOOLEAN_TYPE = 4
- FLOAT_TYPE = 3
- INTEGER_TYPE = 1
- ITEMS_ARRAY = 6
- NUMBER_TYPE = 5
- STRING_TYPE = 2
Properties
- $defaultError : string|null
- Default errror code
- $error : string|null
- Rule error
- $errorParams : array<string|int, mixed>
- Error params
- $params : Collection
- Rule params
Methods
- __construct() : mixed
- Constructor
- getError() : string|null
- Return validation error code
- getErrorParams() : array<string|int, mixed>
- Get error params
- getParams() : Collection
- Return rule params
- getType() : mixed
- Return filter type
- isRequired() : bool
- Return true if field rule is required
- required() : void
- Set rule required
- setDefaultError() : void
- Set default error code
- setError() : void
- Set validation error ode
- setErrorParams() : void
- Set error params
- validate() : bool
- Validate value
- validateType() : bool
- Validate field type
Constants
BOOLEAN_TYPE
public
mixed
BOOLEAN_TYPE
= 4
FLOAT_TYPE
public
mixed
FLOAT_TYPE
= 3
INTEGER_TYPE
public
mixed
INTEGER_TYPE
= 1
ITEMS_ARRAY
public
mixed
ITEMS_ARRAY
= 6
NUMBER_TYPE
public
mixed
NUMBER_TYPE
= 5
STRING_TYPE
public
mixed
STRING_TYPE
= 2
Properties
$defaultError
Default errror code
protected
string|null
$defaultError
= null
$error
Rule error
protected
string|null
$error
= null
$errorParams
Error params
protected
array<string|int, mixed>
$errorParams
= []
$params
Rule params
protected
Collection
$params
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed> $params = [] ][, string|null $error = null ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
- $error : string|null = null
getError()
Return validation error code
public
getError() : string|null
Return values
string|nullgetErrorParams()
Get error params
public
getErrorParams() : array<string|int, mixed>
Return values
array<string|int, mixed>getParams()
Return rule params
public
getParams() : Collection
Return values
CollectiongetType()
Return filter type
public
getType() : mixed
isRequired()
Return true if field rule is required
public
isRequired() : bool
Return values
boolrequired()
Set rule required
public
required([bool $value = true ]) : void
Parameters
- $value : bool = true
setDefaultError()
Set default error code
public
setDefaultError(string $errorCode) : void
Parameters
- $errorCode : string
setError()
Set validation error ode
public
setError(string|null $error[, string|null $default = null ]) : void
Parameters
- $error : string|null
- $default : string|null = null
setErrorParams()
Set error params
public
setErrorParams([array<string|int, mixed> $params = [] ]) : void
Parameters
- $params : array<string|int, mixed> = []
validate()
Validate value
public
validate(string $value) : bool
Parameters
- $value : string
Return values
boolvalidateType()
Validate field type
protected
validateType(mixed $value, int $type) : bool
Parameters
- $value : mixed
- $type : int