
| Current Path : /var/www/html/strat/vendor/chi-teck/drupal-code-generator/src/Validator/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/strat/vendor/chi-teck/drupal-code-generator/src/Validator/ClassName.php |
<?php
declare(strict_types=1);
namespace DrupalCodeGenerator\Validator;
/**
* Validates PHP class name.
*/
final class ClassName {
/**
* @throws \UnexpectedValueException
*/
public function __invoke(mixed $value): string {
if (!\is_string($value) || !\preg_match('/^[A-Z][a-zA-Z0-9]+$/', $value)) {
throw new \UnexpectedValueException('The value is not correct class name.');
}
return $value;
}
}