TextDirection
: string
in package
The direction a piece of text is read in, as the HTML "dir" attribute spells it.
There are only three of them, so a document, a container or a piece of inline text carries one of these rather than whatever string the author happened to write. Anything else is refused where it is read, and the reader is left with TextDirection::Auto: a direction the browser works out for itself is a worse answer than the right one and a better answer than a "dir" attribute that means nothing.
Table of Contents
Cases
Methods
- tryFromUserInput() : self|null
- The direction an author wrote, or null when it is none of them.
Cases
Ltr
Rtl
Auto
Methods
tryFromUserInput()
The direction an author wrote, or null when it is none of them.
public
static tryFromUserInput(string $direction) : self|null
Case and surrounding space are forgiven -- ":dir: RTL" means what it looks like -- so that only a genuinely unknown direction is refused.
Parameters
- $direction : string