Validator
extends KBase
in package
Class for validating various variables.
Tags
Table of Contents
- $cfg : object
- Config class instance.
- $request : Request
- Server request class instance.
- email() : bool
- Validates an email address.
- isImage() : array<string|int, mixed>|bool
- Checks if an uploaded file is an image.
Properties
$cfg
Config class instance.
protected
static object
$cfg
$request
Server request class instance.
protected
static Request
$request
Methods
email()
Validates an email address.
public
static email(string $email) : bool
Returns true if the email format is correct.
Parameters
- $email : string
Tags
Return values
bool —isImage()
Checks if an uploaded file is an image.
public
static isImage(array<string|int, mixed> $excepts, array<string|int, mixed> $file_upload) : array<string|int, mixed>|bool
Returns an array [ext, width, height, mime] of the image if it is an image, or false if it is not an image.
Parameters
- $excepts : array<string|int, mixed>
-
Accepted file types, e.g. array('jpg', 'gif', 'png')
- $file_upload : array<string|int, mixed>
-
Value from $_FILES