The field under validation must be present only when all of the other specified fields are not present.

@param      $anotherfields

@param null $error_message

@return ValidateBuilder
@throws \Exception
176109
function ruleRequiredWithoutAll($anotherfields, $error_message = null) {
        if (is_array($anotherfields)) {
            $anotherfields = implode(',', $anotherfields);
        }

        return $this->_rule('required_without_all:' . $anotherfields, $error_message);
    }
1054368
protected function throwNewInvalidArgumentException ($errorMsg) {
		$selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__;
		$str = '['.$selfClass.'] ' . $errorMsg . ' (';
		if ($this->form) {
			$str .= 'form id: `'.$this->form->GetId() . '`, '
				. 'form type: `'.get_class($this->form).'`, ';
		}
		$str .= 'field type: `'.get_class($this) . '`)';
		throw new \InvalidArgumentException($str);
	}
195460
public function addValidationError($field, $errorMessage)
    {
        $this->_isValid = false;
        $this->_validationErrors[$field] = $errorMessage;
    }
947521
private String buildValidationErrorMessage(String message, Object expectedValue, Object actualValue) {
        return message + ", expected '" + expectedValue + "' but was '" + actualValue + "'";
    }
369609
public function inFieldValidator($val, string $anotherField): bool
    {
        if ($anotherField && $dict = $this->getByPath($anotherField)) {
            return Validators::in($val, $dict);
        }

        return false;
    }
1111511
protected function getColumnIndexByValue(string $value, string $error_message): string
    {
        if (false !== array_search($value, $this->header, true)) {
            return $value;
        }

        throw new Exception(sprintf($error_message, $value));
    }
446765
public static function formatErrorMessage(array $error_message)
    {
        $msg = $error_message['msg'] ?? "";
        $context = $error_message['context'] ?? [];
        if (class_exists("Wedeto\I18n\I18nShortcut"))
        {
            return t($msg, $context);
        }

        return WF::fillPlaceholders($msg, $context);
    }
673986
public function addRequired($field, $errorMsg = null, $validate = self::VALID_NOT_EMPTY)
    {
        $obj = new \stdClass;
        $obj->message = ($errorMsg == null) ? t('Field "%s" is invalid', $field) : $errorMsg;
        $obj->field = $field;
        $obj->validate = $validate;
        $this->fields[] = $obj;
    }
1145829
public function addRequiredField($fieldName, $message = null)
    {
        return $this->setRule($fieldName, RequiredRule::create($message));
    }
399538
public function withErrors($errors, $message = null)
    {
        if (! $errors instanceof MessageBag) {
            $errors = new MessageBag((array) $errors);
        }

        if (! is_null($message)) {
            $errors->add('__message', $message);
        }

        $this->with('errors', $errors->toArray());

        return $this;
    }
508232
public function validate() {

		if ($this->getFieldName() === null) {
			throw new ValidationException("'fieldName' can't be null", 'fieldName', $this);
		}
		if ($this->getSorting() === null) {
			throw new ValidationException("'sorting' can't be null", 'sorting', $this);
		}
	}
639872
public function reportError(string $error_message) : void
    {
        $error_message = sprintf($error_message, $this->field_name);
        if (null != $this->validation_set) {
            $this->validation_set->addValidationError(new ValidationError($this->field_name, $error_message));
        }
    }
382998
protected function throwValidationException(string $message, string $prefix = null)
    {
        throw new ValidationException($message, $this->name, $prefix);
    }
694762
protected function setErrorField($name, $value, $messages, $arrayIndex = null)
    {
        // Loop through all errors
        foreach ($messages as $errorType => $error) {
            // When the validation messages are about an array, they are set in a sub array (validation_errors)
            if (is_numeric($errorType) && is_array($error) && isset($error['validation_errors'])) {
                // Array index is 1 based so deduct one to create 0 based index
                $arrayIndex = ((int) $errorType) - 1;
                $this->setErrorField(
                    $name,
                    isset($value[$arrayIndex]) ? $value[$arrayIndex] : null,
                    $error['validation_errors'],
                    $arrayIndex
                );
            } elseif (is_array($error)) {
                // When there is an array of errors returned, handle them recursively
                $this->setErrorField($name, $value, $error, $arrayIndex);
            } else {
                // Add error field with all information
                $this->errorFields[] = new ErrorField($name, $value, $errorType, $error, $arrayIndex);
            }
        }
    }
902046
public static function error($name = '', $message = '', $data = array(), $other = array())
    {
        return self::write($name, 'ERROR', $message, $data, $other);
    }
1098083
public function fieldGreaterThanOrEqualAnother(string $fieldName, string $otherFieldName)
    {
        $this->validateFieldsExist(__METHOD__, $fieldName, $otherFieldName);

        return $this->validate(new FieldGreaterThanOrEqualAnotherValidator($this->fields[$fieldName], $this->fields[$otherFieldName]));
    }
1257729
public function validate($validationRules = [], $messages = [])
    {
        $fieldRules = $this->formHelper->mergeFieldsRules($this->fields);
        $rules = array_merge($fieldRules->getRules(), $validationRules);
        $messages = array_merge($fieldRules->getMessages(), $messages);

        $this->validator = $this->validatorFactory->make($this->getRequest()->all(), $rules, $messages);
        $this->validator->setAttributeNames($fieldRules->getAttributes());

        $this->eventDispatcher->dispatch(new BeforeFormValidation($this, $this->validator));

        return $this->validator;
    }