private function applyRuleToField(
        string $fieldName,
        string $ruleName,
        array $options = []
    ): void {
        if (!isset($this->rules[$ruleName])) {
            throw new Exception('Undefined rule name.');
        }
        $func = $this->rules[$ruleName][0];
        if (!$func($fieldName, $options)) {
            if (isset($this->rules[$ruleName][1])) {
                if (is_callable($this->rules[$ruleName][1])) {
                    // If message entity is function
                    $funcMsg = $this->rules[$ruleName][1];
                    $this->addError($funcMsg($fieldName, $options));
                } else {
                    // If message entity is string
                    $this->addError((string) $this->rules[$ruleName][1]);
                }
            } else {
                // If message entity isn't set
                $this->addDefaultError($fieldName);
            }
        }
    }