AbstractRule
extends AbstractMethod
in package
implements
RuleInterface
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
= []
$methods
private
array<string, callable>
$methods
= []
$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|nullgetMethods()
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
boolhasMethod()
Checks if a method exists by the given case-sensitive name.
public
hasMethod(string $Name) : bool
Parameters
- $Name : string
-
The method name.
Return values
boolhasRule()
Checks if a rule exists by the given case-sensitive name.
public
hasRule(string $Name) : bool
Parameters
- $Name : string
-
The rule name.
Return values
boolwithError()
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
staticwithMethod()
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
staticwithoutError()
Return an instance without the specified error.
public
withoutError(string $Name) : static
Parameters
- $Name : string
-
The error name.
Return values
staticwithoutMethod()
Return an instance without the specified method.
public
withoutMethod(string $Name) : static
Parameters
- $Name : string
-
The method name.
Return values
staticwithoutRule()
Return an instance without the specified rule.
public
withoutRule(string $Name) : static
Parameters
- $Name : string
-
The rule name.
Return values
staticwithRule()
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.