blob: 23b48469c01a8b482c44e4b0ec6c9c1fcbc8a15a [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Adldap\Configuration\Validators;
4
5use Adldap\Configuration\ConfigurationException;
6
7/**
8 * Class BooleanValidator.
9 *
10 * Validates that the configuration value is a boolean.
11 */
12class BooleanValidator extends Validator
13{
14 /**
15 * {@inheritdoc}
16 */
17 public function validate()
18 {
19 if (!is_bool($this->value)) {
20 throw new ConfigurationException("Option {$this->key} must be a boolean.");
21 }
22
23 return true;
24 }
25}