code: private static function collectErrors($models, $showAllErrors)
      {
          $lines = [];
          if (!is_array($models)) {
              $models = [$models];
          }
  
          foreach ($models as $model) {
              $lines = array_unique(array_merge($lines, $model->getErrorSummary($showAllErrors)));
          }
  
          return $lines;
      }
docs: Return array of the validation errors
  @param Model|Model[] $models the model(s) whose validation errors are to be displayed.
  @param $showAllErrors boolean, if set to true every error message for each attribute will be shown otherwise
  only the first error message for each attribute will be shown.
  @return array of the validation errors
  @since 2.0.14