blob: cd783c4b7b4940b68fd1460c1df4292bc48c6726 [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 IntegerValidator.
9 *
10 * Validates that the configuration value is an integer / number.
11 */
12class IntegerValidator extends Validator
13{
14 /**
15 * {@inheritdoc}
16 */
17 public function validate()
18 {
19 if (!is_numeric($this->value)) {
20 throw new ConfigurationException("Option {$this->key} must be an integer.");
21 }
22
23 return true;
24 }
25}