| Total Complexity | 4 |
| Total Lines | 42 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | abstract class BaseValidator implements Validator |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | protected $key; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @param EditableConfig $config The configuration object. |
||
| 22 | * @param mixed $value The value to validate. |
||
| 23 | */ |
||
| 24 | abstract protected function validateValue(EditableConfig $config, $value): void; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $key The key of the configuration to validate. |
||
| 28 | */ |
||
| 29 | public function __construct(string $key) |
||
| 30 | { |
||
| 31 | $this->key = $key; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Returns the configuration key. |
||
| 36 | */ |
||
| 37 | public function getKey(): string |
||
| 38 | { |
||
| 39 | return $this->key; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param EditableConfig $config The configuration object. |
||
| 44 | * @param array<mixed> $configuration The array containing the configuration values. |
||
| 45 | */ |
||
| 46 | public function validate(EditableConfig $config, array $configuration): void |
||
| 55 | } |
||
| 56 | } |
||
| 57 |