ConnectionOptionsValidator
extends Validator
in package
Validate the connection options to access the database.
Tags
Table of Contents
Properties
- $canHave : array<string|int, mixed>
- The connection array can have these keys.
- $data : array<string|int, mixed>
- Data to validate.
- $required : array<string|int, mixed>
- Required keys in connections arrays.
Methods
- __construct() : mixed
- ConnectionOptionsValidator constructor.
- getConnectionOptions() : array<string|int, mixed>
- Return all connection options.
- rules() : array<string|int, mixed>
- Rules for connection
- validate() : true
- Validate user data
Properties
$canHave
The connection array can have these keys.
protected
array<string|int, mixed>
$canHave
= ['connection', 'timeout', 'reconnect', 'create', 'policy', 'host', 'port']
$data
Data to validate.
protected
array<string|int, mixed>
$data
= []
$required
Required keys in connections arrays.
protected
array<string|int, mixed>
$required
= ['endpoint', 'database', 'username', 'password']
Methods
__construct()
ConnectionOptionsValidator constructor.
public
__construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $data : array<string|int, mixed> = []
-
Attributes to validate.
getConnectionOptions()
Return all connection options.
public
getConnectionOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>rules()
Rules for connection
public
rules() : array<string|int, mixed>
Return values
array<string|int, mixed>validate()
Validate user data
public
validate() : true
Tags
Return values
true —if validation is successful, throw an exception otherwise.