PHP Validation

AbstractRule extends AbstractMethod
in package
implements RuleInterface

AbstractYes

This is a simple Rule implementation that other Rule can inherit from.

Table of Contents

Interfaces

RuleInterface
Describes Rule interface.

Properties

$errors  : array<string, array<string, mixed>>
$methods  : array<string, callable>
$rules  : array<string, array<string, mixed>>

Methods

getError()  : array<string, mixed>
Retrieve a validation error value by the given case-sensitive name.
getErrors()  : array<string, array<string, mixed>>
Retrieves all validation error values.
getMethod()  : callable|null
Retrieve a validation method callback by the given case-sensitive name.
getMethods()  : array<string, callable>
Retrieves all validation method callbacks.
getRule()  : array<string, mixed>
Retrieve a validation rule value by the given case-sensitive name.
getRules()  : array<string, array<string, mixed>>
Retrieves all validation rule values.
hasError()  : bool
Checks if a error exists by the given case-sensitive name.
hasMethod()  : bool
Checks if a method exists by the given case-sensitive name.
hasRule()  : bool
Checks if a rule exists by the given case-sensitive name.
withError()  : static
Return an instance with the provided value replacing the specified error.
withMethod()  : static
Return an instance with the provided callback replacing the specified method.
withoutError()  : static
Return an instance without the specified error.
withoutMethod()  : static
Return an instance without the specified method.
withoutRule()  : static
Return an instance without the specified rule.
withRule()  : static
Return an instance with the provided value replacing the specified rule.

Properties

$errors

private array<string, array<string, mixed>> $errors = []

$rules

private array<string, array<string, mixed>> $rules = []

Methods

getError()

Retrieve a validation error value by the given case-sensitive name.

public getError(string $Name) : array<string, mixed>
Parameters
$Name : string

The error name.

Return values
array<string, mixed>

getErrors()

Retrieves all validation error values.

public getErrors() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>

getMethod()

Retrieve a validation method callback by the given case-sensitive name.

public getMethod(string $Name) : callable|null
Parameters
$Name : string

The method name.

Return values
callable|null

getMethods()

Retrieves all validation method callbacks.

public getMethods() : array<string, callable>
Return values
array<string, callable>

getRule()

Retrieve a validation rule value by the given case-sensitive name.

public getRule(string $Name) : array<string, mixed>
Parameters
$Name : string

The rule name.

Return values
array<string, mixed>

getRules()

Retrieves all validation rule values.

public getRules() : array<string, array<string, mixed>>
Return values
array<string, array<string, mixed>>

hasError()

Checks if a error exists by the given case-sensitive name.

public hasError(string $Name) : bool
Parameters
$Name : string

The error name.

Return values
bool

hasMethod()

Checks if a method exists by the given case-sensitive name.

public hasMethod(string $Name) : bool
Parameters
$Name : string

The method name.

Return values
bool

hasRule()

Checks if a rule exists by the given case-sensitive name.

public hasRule(string $Name) : bool
Parameters
$Name : string

The rule name.

Return values
bool

withError()

Return an instance with the provided value replacing the specified error.

public withError(string $Name, string $Message[, int $Code = 0 ]) : static
Parameters
$Name : string

The error name.

$Message : string

The error message.

$Code : int = 0

The error code.

Return values
static

withMethod()

Return an instance with the provided callback replacing the specified method.

public withMethod(string $Name, callable $Callback) : static
Parameters
$Name : string

The method name.

$Callback : callable

The method callback.

Return values
static

withoutError()

Return an instance without the specified error.

public withoutError(string $Name) : static
Parameters
$Name : string

The error name.

Return values
static

withoutMethod()

Return an instance without the specified method.

public withoutMethod(string $Name) : static
Parameters
$Name : string

The method name.

Return values
static

withoutRule()

Return an instance without the specified rule.

public withoutRule(string $Name) : static
Parameters
$Name : string

The rule name.

Return values
static

withRule()

Return an instance with the provided value replacing the specified rule.

public withRule(string $Name, array<string, mixed> $Rule) : static
Parameters
$Name : string

The rule name.

$Rule : array<string, mixed>

The rule value.

Return values
static

        
On this page

Search results