\HTMLPurifier_Length

Represents a measurable length, with a string numeric magnitude and a unit. This object is immutable.

Summary

Methods
Properties
Constants
__construct()
make()
toString()
getN()
getUnit()
isValid()
compareTo()
No public properties found
No constants found
validate()
$n
$unit
$isValid
$allowedUnits
N/A
No private methods found
No private properties found
N/A

Properties

$n

$n

String numeric magnitude.

$unit

$unit

String unit. False is permitted if $n = 0.

$isValid

$isValid

Whether or not this length is valid. Null if not calculated yet.

$allowedUnits

$allowedUnits

Array Lookup array of units recognized by CSS 3

Methods

__construct()

__construct(string  $n = '0', bool|string  $u = false) : mixed

Parameters

string $n

Magnitude

bool|string $u

Unit

Returns

mixed —

make()

make(string  $s) : \HTMLPurifier_Length

Parameters

string $s

Unit string, like '2em' or '3.4in'

Returns

\HTMLPurifier_Length —

toString()

toString() : string

Returns string representation of number.

Returns

string —

getN()

getN() : string

Retrieves string numeric magnitude.

Returns

string —

getUnit()

getUnit() : string

Retrieves string unit.

Returns

string —

isValid()

isValid() : bool

Returns true if this length unit is valid.

Returns

bool —

compareTo()

compareTo(\HTMLPurifier_Length  $l) : int

Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.

Parameters

\HTMLPurifier_Length $l

Returns

int —

validate()

validate() : bool

Validates the number and unit.

Returns

bool —