private function setMessageset(array $messages = [])
    {
        // Passed messages rule, but we will use model messages if nothing has been passed
        $this->messageset = $this->selectMessages($messages);

        // If we don't have any rules, don't do anything because an error will never occur
        if ( ! count($this->rules)) return;

        // Determine file for validation messages
        $file = $this->languageFolder . '/' . str_replace('\\', '/', get_called_class()) . '.';

        $this->messages = [];

        // Process each rule
        foreach($this->rules as $field => $set)
        {
            foreach ($set as $rule)
            {
                // Remove parameters if we have them
                list($type,) = $this->getRuleTypeAndParameters($rule);

                // Generate a key using language file dot notation e.g. 'username.required'
                $key = implode('.', [$field, $type]);

                // Try to find a suitable error message
                $message = $this->getMessage($file, $key);
                if ($message) $this->messages[$key] = $message;
            }
        }
    }