PHP Validation

BuildInFormat extends AbstractBuildIn
in package

Simple Build-In Format implementation.

Table of Contents

Constants

FORMAT_DATETIME  = 2
FORMAT_FILTERVAR  = 1

Properties

$assert  : string
$error_code  : int
$error_message  : string

Methods

getAssert()  : string
Retrieve assert name.
getErrorCode()  : int
Retrieve error code.
getErrorMessage()  : string
Retrieve error message.
getMethod()  : callable
Retrieve method callback.
guardInvalidType()  : static
Guard an instance from invalid type of value.
guardNonExists()  : static
Guard an instance from nonexists of data.
formatDateVal()  : bool
Retrieve date validation format.
formatFilterVal()  : bool
Retrieve filter_val validation format.
formatMetadata()  : array<string, array<string, mixed>>
Retrieve format metadata.

Constants

Properties

$error_code

protected int $error_code = \Samy\Validation\Constant\ValidationError::FORMAT

$error_message

protected string $error_message = "The '{{attribute}}' has invalid '{{expect}}' format."

Methods

getAssert()

Retrieve assert name.

public getAssert() : string
Return values
string

getErrorCode()

Retrieve error code.

public getErrorCode() : int
Return values
int

getErrorMessage()

Retrieve error message.

public getErrorMessage() : string
Return values
string

getMethod()

Retrieve method callback.

public getMethod() : callable
Return values
callable

guardInvalidType()

Guard an instance from invalid type of value.

public guardInvalidType(mixed $Value, array<string|int, string> $Types, string $ErrorMessage, int $ErrorCode) : static
Parameters
$Value : mixed

The value.

$Types : array<string|int, string>

The expect types.

$ErrorMessage : string

The error message.

$ErrorCode : int

The error code.

Tags
throws
InvalidArgumentException

If invalid.

Return values
static

guardNonExists()

Guard an instance from nonexists of data.

public guardNonExists(array<string|int, mixed> $Data, string $Key, string $ErrorMessage, int $ErrorCode) : static
Parameters
$Data : array<string|int, mixed>

The data.

$Key : string

The key.

$ErrorMessage : string

The error message.

$ErrorCode : int

The error code.

Tags
throws
InvalidArgumentException

If invalid.

Return values
static

formatDateVal()

Retrieve date validation format.

private formatDateVal(string $Value, string $Format) : bool
Parameters
$Value : string
$Format : string
Return values
bool

formatFilterVal()

Retrieve filter_val validation format.

private formatFilterVal(string $Value, int $Filter, int $Option) : bool
Parameters
$Value : string
$Filter : int
$Option : int
Return values
bool

formatMetadata()

Retrieve format metadata.

private formatMetadata() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>

        
On this page

Search results