HTMLPurifier_Length
Represents a measurable length, with a string numeric magnitude and a unit. This object is immutable.
- Full name:
\HTMLPurifier_Length
Properties
n
String numeric magnitude.
unit
String unit. False is permitted if $n = 0.
isValid
Whether or not this length is valid. Null if not calculated yet.
allowedUnits
Array Lookup array of units recognized by CSS 3
- This property is static.
Methods
__construct
Parameters:
Parameter | Type | Description |
---|---|---|
$n |
string | Magnitude |
$u |
bool|string | Unit |
make
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$s |
string | Unit string, like '2em' or '3.4in' |
validate
Validates the number and unit.
toString
Returns string representation of number.
getN
Retrieves string numeric magnitude.
getUnit
Retrieves string unit.
isValid
Returns true if this length unit is valid.
compareTo
Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
Parameters:
Parameter | Type | Description |
---|---|---|
$l |
\HTMLPurifier_Length |
Automatically generated on 2025-03-18