/** * Combines the results of two different model validation calls * * @param bool|ValidationResult $one FALSE (if nothing was submitted) or a * ValidationResult object. * @param bool|ValidationResult $two FALSE (if nothing was submitted) or a * ValidationResult object. * @return bool|ValidationResult $one FALSE (if nothing was submitted) or a * ValidationResult object. */ private function combineResults($one, $two) { $result = FALSE; if ($one instanceof ValidationResult) { $result = $one; if ($two instanceof ValidationResult && $two->failed()) { foreach ($two->getFailed() as $field => $rules) { foreach ($rules as $rule) { $result->addFailed($field, $rule); } } } } elseif ($two instanceof ValidationResult) { $result = $two; } return $result; }