/** * @param ReservationSeries $reservationSeries * @return ReservationRuleResult */ public function Validate($reservationSeries) { $resources = Resources::GetInstance(); $errorMessage = new StringBuilder(); $result = $this->attributeService->Validate(CustomAttributeCategory::RESERVATION, $reservationSeries->AttributeValues()); $isValid = $result->IsValid(); foreach ($result->Errors() as $error) { $errorMessage->AppendLine($error); } if (!$isValid) { $errorMessage->PrependLine($resources->GetString('CustomAttributeErrors')); } return new ReservationRuleResult($isValid, $errorMessage->ToString()); }