blob: 717c95237d03b9cb8f83999de7ebc23cea6d2316 [file] [log] [blame]
<?php
namespace Adldap\Configuration\Validators;
use Adldap\Configuration\ConfigurationException;
/**
* Class StringOrNullValidator.
*
* Validates that the configuration value is a string or null.
*/
class StringOrNullValidator extends Validator
{
/**
* {@inheritdoc}
*/
public function validate()
{
if (is_string($this->value) || is_null($this->value)) {
return true;
}
throw new ConfigurationException("Option {$this->key} must be a string or null.");
}
}