Addd validation rule

@param mixed   $validation Callable or some default validation method name
@param string  $message
@param integer $severity

@return \UniMapper\Validator
423533
public function addRule($validation, $message, $severity = Validator\Rule::ERROR)
    {
        $this->rules[] = new Validator\Rule(
            $this->entity,
            $this->_getValidation($validation),
            $message,
            $this->property,
            $severity,
            $this->child
        );
        return $this;
    }
728551
private function assertCallback(callable $callback, string $message = 'failed callback assertion'): Validator
    {
        $variablesFailingAssertion = [];

        foreach ($this->variables as $variableName) {

            $variableValue = $this->loader->getVariable($variableName);

            if (call_user_func($callback, $variableValue) === false) {
                $variablesFailingAssertion[] = $variableName." $message";
            }
        }

        if (count($variablesFailingAssertion) > 0) {

            throw new RuntimeException(sprintf(
                'One or more environment variables failed validation: %s',
                implode(', ', $variablesFailingAssertion)
            ));
        }

        return $this;
    }
860977
protected function addElementError($message)
    {
        if ($this->element === null) {
            throw new \RuntimeException('Create a form element prior to adding a validation error', 1519731421);
        }
        $this->addError($this->element->getIdentifier(), $message);
    }
401206
public function decodeMessage($message, $data)
    {
        // Get message descriptor
        $pool = DescriptorPool::getGeneratedPool();
        $messageType = $pool->getDescriptorByClassName(get_class($message));
        try {
            return $this->decodeMessageImpl($message, $messageType, $data);
        } catch (\Exception $e) {
            throw new ValidationException(
                "Error decoding message: " . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
30072
public function required($message = null)
    {
        $this->setRule(__FUNCTION__, function($val)
                       {
                           if (is_scalar($val)) {
                               $val = trim($val);
                           }
                           return !empty($val);
                       }, $message);
        return $this;
    }
35122
protected function validationResult($message, $field = null)
    {
        $error = ValidationResult::create()
            ->addFieldError($field, $message);
        return new ValidationException($error);
    }
1206312
public void add(ValidationResult validation) {
    correct &= validation.correct;
    if (!validate) return;
    errors.addAll(validation.errors);
    warnings.addAll(validation.warnings);
  }
241663
protected function isValidMessage($message): Message
    {
        if ($message instanceof Message) {
            return $message;
        }

        if (\is_string($message) || $message instanceof Attachment) {
            return Message::create($message);
        }

        throw new MessengerException(sprintf(
            'message must be a string or an instance of %s or %s.',
            Message::class,
            Attachment::class
        ));
    }
1054081
public function addRule(string $name, callable $callback, string $message = null): self
    {
        if ($message === null) {
            $message = static::ERROR_DEFAULT;
        }

        static::assertRuleCallback($callback);

        static::$_rules[$name] = $callback;
        static::$_ruleMessages[$name] = $message;

        return $this;
    }
1046691
protected function log($message, $severity = LOG_INFO)
    {
        if (!isset($this->severityLabels[$severity])) {
            throw new Exception('Invalid severity value', 1426868867);
        }
        $this->importService->addEventMessage(sprintf('Record:Import:Log:%s', $this->severityLabels[$severity]), $message, $severity, $this->currentEvent);
    }
463036
public function validatorCallback($modifier, $rules, array $messages = [], array $customAttributes = []): \Closure
    {
        $validator = function () use ($modifier, $rules, $messages, $customAttributes) {
            if (is_callable($rules)) {
                $rules = $rules();
            }

            $data = app()->call($modifier, [request()->all()]);
            $validator = resolve(Factory::class)->make($data, $rules, $messages, $customAttributes);
            $validator->validate();
        };

        return resolve(HeyManSwitcher::class)->wrapForIgnorance($validator, 'validation');
    }
1362912
function( name, method, message ) {
		$.validator.methods[name] = method;
		$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];
		if ( method.length < 3 ) {
			$.validator.addClassRules(name, $.validator.normalizeRule(name));
		}
	}
138793
protected function log($message, $severity)
	{
		if (!empty($this->log_function))
		{
			if (isset($this->log_function[$severity]))
			{
				return call_user_func_array($this->log_function[$severity], array($message, $severity));
			}
			elseif (isset($this->log_function[self::LOG_LEVEL_ALL]))
			{
				return call_user_func_array($this->log_function[self::LOG_LEVEL_ALL], array($message, $severity));
			}
		}
		// Barracuda specific logging class, to keep internal code working
		elseif (method_exists('Log', 'message'))
		{
			return Log::message($message, $severity);
		}

		return true;
	}
109770
public function set_message($rule, $message)
	{
		if ($message !== null)
		{
			$this->error_messages[$rule] = $message;
		}
		else
		{
			unset($this->error_messages[$rule]);
		}

		return $this;
	}
1129615
public function assert(callable $validation, string $messageId = null, array $parameters = [])
    {
        return $this->validate(new CustomFormValidator($validation, $messageId, $parameters));
    }
67188
private function format($message, $severity)
    {
        $msg = date("m-d-Y") . " " . date("G:i:s") . " " . self::$remoteIp;

        $IPLength = strlen(self::$remoteIp);
        $numWhitespaces = 15 - $IPLength;

        for ($i = 0; $i < $numWhitespaces; $i++) {
            $msg .= " ";
        }

        $msg .= " " . $severity . ": ";

        $lastSlashIndex = strrpos(self::$script, "/");
        $fileName = self::$script;

        if ($lastSlashIndex !== false) {
            $fileName = substr(self::$script, $lastSlashIndex + 1);
        }

        $msg .= $fileName . "\t";
        $msg .= ": " . $message . "\r\n";

        return $msg;
    }
1358814
public function addValidation($validation, $value = null)
    {
        if (false === isset($this->validation[$validation])) {
            $this->validation[$validation] = [];
        }

        $this->validation[$validation][] = $value;

        return $this;
    }