code: private function createEmbeddedValidator($model)
      {
          $rule = $this->rule;
          if ($rule instanceof Validator) {
              return $rule;
          } elseif (is_array($rule) && isset($rule[0])) { // validator type
              if (!is_object($model)) {
                  $model = new Model(); // mock up context model
              }
  
              return Validator::createValidator($rule[0], $model, $this->attributes, array_slice($rule, 1));
          }
  
          throw new InvalidConfigException('Invalid validation rule: a rule must be an array specifying validator type.');
      }
docs: Creates validator object based on the validation rule specified in [[rule]].
  @param Model|null $model model in which context validator should be created.
  @throws \yii\base\InvalidConfigException
  @return Validator validator instance