You are here

public function JsonBlueprintDenormalizer::setValidator in Subrequests 3.x

Same name and namespace in other branches
  1. 8.2 src/Normalizer/JsonBlueprintDenormalizer.php \Drupal\subrequests\Normalizer\JsonBlueprintDenormalizer::setValidator()

Sets the validator service if available.

File

src/Normalizer/JsonBlueprintDenormalizer.php, line 50

Class

JsonBlueprintDenormalizer
Denormalizer that builds the blueprint based on the incoming blueprint.

Namespace

Drupal\subrequests\Normalizer

Code

public function setValidator(Validator $validator = NULL) {
  if ($validator) {
    $this->validator = $validator;
  }
  elseif (class_exists(Validator::class)) {
    $this->validator = new Validator();
  }
}