protected function errorMessage($filter, $field, $params = null)
    {
        $text = (isset($this->texts[$field][$filter]) && ! is_null($this->texts[$field][$filter])
            ? $this->texts[$field][$filter] : $this->msg);
        $text = str_replace([':label:', ':value:'], '%s', $text);

        if (! isset($this->data[$field])) {
            $this->errors[] = sprintf($text, $this->labels[$field], $params);
        } elseif (! is_null($params)) {
            if ($filter == 'matches') {
                if ($this->matches($this->data[$field], $this->data[$params]) === false) {
                    $this->errors[] = sprintf($text, $this->labels[$field], $params);
                }
            } else {
                if ($this->$filter($this->data[$field], $params) === false) {
                    $this->errors[] = sprintf($text, $this->labels[$field], $params);
                }
            }
        } else {
            if ($this->$filter($this->data[$field]) === false) {
                $this->errors[] = sprintf($text, $this->labels[$field], $params);
            }
        }
    }