Problem
When using Message::text(), it is easy to assume that the method would return text rather than HTML. The documentation does say:
@return string Unescaped message text.
but that's not all that clear because the method name implies that there wouldn't be any HTML anyways.
Solution
- Rename this method to raw()
- Create a new text() method that is the same as the previous method, but with the output run through strip_tags() so that any HTML tags will be removed.
Alternatively, clearly document that text is not what is returned but rather html.