UploadedFile
- Full name:
\Qubus\Validation\Rules\UploadedFile - Parent class:
\Qubus\Validation\Rule - This class implements:
\Qubus\Validation\Rules\Interfaces\BeforeValidate
Properties
message
maxSize
minSize
allowedTypes
Methods
fillParameters
Given $params and assign $this->params.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$params | array |
maxSize
Given $size and set the max size
Parameters:
| Parameter | Type | Description |
|---|---|---|
$size | int|string|null |
minSize
Given $size and set the min size
Parameters:
| Parameter | Type | Description |
|---|---|---|
$size | int|string|null |
sizeBetween
Given $min and $max then set the range size
Parameters:
| Parameter | Type | Description |
|---|---|---|
$min | int|string|null | |
$max | int|string|null |
fileTypes
Given $types and assign $this->params
Parameters:
| Parameter | Type | Description |
|---|---|---|
$types | mixed |
beforeValidate
Before validate hook.
check
Check the $value is valid.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
Inherited methods
check
- This method is abstract. Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
setValidation
Set Validation class instance
Parameters:
| Parameter | Type | Description |
|---|---|---|
$validation | \Qubus\Validation\Validation |
setKey
Set key
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string |
getKey
Get key
setAttribute
Set attribute
Parameters:
| Parameter | Type | Description |
|---|---|---|
$attribute | \Qubus\Validation\Attribute |
getAttribute
Get attribute
getParameters
Get parameters
setParameters
Set params
Parameters:
| Parameter | Type | Description |
|---|---|---|
$params | array |
setParameter
Set parameters
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$value | mixed |
fillParameters
Fill $params to $this->params
Parameters:
| Parameter | Type | Description |
|---|---|---|
$params | array |
parameter
Get parameter from given $key, return null if it not exists
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string |
setParameterText
Set parameter text that can be displayed in error message using ':param_key'
Parameters:
| Parameter | Type | Description |
|---|---|---|
$key | string | |
$text | string |
getParametersTexts
Get $paramsTexts
isImplicit
Check whether this rule is implicit
message
Just alias of setMessage
Parameters:
| Parameter | Type | Description |
|---|---|---|
$message | string |
setMessage
Set message
Parameters:
| Parameter | Type | Description |
|---|---|---|
$message | string |
getMessage
Get message
requireParameters
Check given $params must exist.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$params | array |
Throws:
getValueSize
Get size (int) value from given $value
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
getBytesSize
Given $size and get the bytes
Parameters:
| Parameter | Type | Description |
|---|---|---|
$size | mixed |
Throws:
isUploadedFileValue
Check whether value is from $_FILES
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
isValueFromUploadedFiles
Check whether value is from $_FILES
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
isUploadedFile
Check the $value is uploaded file
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |
resolveUploadedFileValue
Resolve uploaded file value
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | mixed |