Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace Adldap\Configuration\Validators; |
| 4 | |
| 5 | use Adldap\Configuration\ConfigurationException; |
| 6 | |
| 7 | class 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 | } |