function ResourceResponseValidator::setValidator
Same name in other branches
- 9 core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator::setValidator()
- 8.9.x core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator::setValidator()
- 10 core/modules/jsonapi/src/EventSubscriber/ResourceResponseValidator.php \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator::setValidator()
Sets the validator service if available.
File
-
core/
modules/ jsonapi/ src/ EventSubscriber/ ResourceResponseValidator.php, line 87
Class
- ResourceResponseValidator
- Response subscriber that validates a JSON:API response.
Namespace
Drupal\jsonapi\EventSubscriberCode
public function setValidator(?Validator $validator = NULL) {
if ($validator) {
$this->validator = $validator;
}
elseif (class_exists(Validator::class)) {
$this->validator = new Validator();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.