private function getValidator($className, $constructorArgs)
{
/** @var ValidationInterface $validator */
$validator = is_string($className) ? new $className($constructorArgs) : $className;
if (!$validator instanceof ValidationInterface) {
throw new BootException(sprintf('System validator was given a validation class %s that does not implement %s', $className, ValidationInterface::class));
}
if ($validator instanceof ResourceManagerAwareInterface) {
$validator->setResourceManager($this->resourceManager);
}
if ($validator instanceof ConfigAwareInterface) {
$validator->setConfig($this->configManager);
}
return $validator;
}