Class Dotenv\Validator

InheritanceDotenv\Validator

This is the validator class.

It's responsible for applying validations against a number of variables.

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$loader Dotenv\Loader Dotenv\Validator
$variables array Dotenv\Validator

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Create a new validator instance. Dotenv\Validator
allowedValues() Assert that each variable is amongst the given choices. Dotenv\Validator
isInteger() Assert that each specified variable is an integer. Dotenv\Validator
notEmpty() Assert that each variable is not empty. Dotenv\Validator

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
assertCallback() Assert that the callback returns true for each variable. Dotenv\Validator

Property Details

$loader protected property
protected Dotenv\Loader $loader null
$variables protected property
protected array $variables null

Method Details

__construct() public method

Create a new validator instance.

public void __construct ( array $variables, Dotenv\Loader $loader )
$variables array
$loader Dotenv\Loader
allowedValues() public method

Assert that each variable is amongst the given choices.

public Dotenv\Validator allowedValues ( array $choices )
$choices string[]
assertCallback() protected method

Assert that the callback returns true for each variable.

protected Dotenv\Validator assertCallback ( $callback, $message 'failed callback assertion' )
$callback callable
$message string
throws \Dotenv\Exception\InvalidCallbackException|\Dotenv\Exception\ValidationException
isInteger() public method

Assert that each specified variable is an integer.

public Dotenv\Validator isInteger ( )
notEmpty() public method

Assert that each variable is not empty.

public Dotenv\Validator notEmpty ( )