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