Class Dotenv\Validator

InheritanceDotenv\Validator

Validator.

Validations to be applied 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
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
notEmpty() public method

Assert that each variable is not empty.

public Dotenv\Validator notEmpty ( )