Moodle  2.2.1
http://www.collinsharper.com
HTMLPurifier_Length Class Reference

Public Member Functions

 __construct ($n= '0', $u=false)
 toString ()
 getN ()
 getUnit ()
 isValid ()
 compareTo ($l)

Static Public Member Functions

static make ($s)

Protected Member Functions

 validate ()

Protected Attributes

 $n
 $unit
 $isValid

Static Protected Attributes

static $allowedUnits

Detailed Description

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

Definition at line 7 of file Length.php.


Constructor & Destructor Documentation

__construct ( n = '0',
u = false 
)
Parameters:
number$nMagnitude
string$uUnit

Definition at line 37 of file Length.php.


Member Function Documentation

compareTo ( l)

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

Warning:
If both values are too large or small, this calculation will not work properly

Definition at line 103 of file Length.php.

getN ( )

Retrieves string numeric magnitude.

Definition at line 83 of file Length.php.

getUnit ( )

Retrieves string unit.

Definition at line 88 of file Length.php.

isValid ( )

Returns true if this length unit is valid.

Definition at line 93 of file Length.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static make ( s) [static]
Parameters:
string$sUnit string, like '2em' or '3.4in'
Warning:
Does not perform validation.

Definition at line 46 of file Length.php.

toString ( )

Returns string representation of number.

Definition at line 75 of file Length.php.

Here is the call graph for this function:

validate ( ) [protected]

Validates the number and unit.

Definition at line 58 of file Length.php.

Here is the caller graph for this function:


Field Documentation

$allowedUnits [static, protected]
Initial value:
 array(
        'em' => true, 'ex' => true, 'px' => true, 'in' => true,
        'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true
    )

Lookup array of units recognized by CSS 2.1

Definition at line 28 of file Length.php.

$isValid [protected]

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

Definition at line 23 of file Length.php.

$n [protected]

String numeric magnitude.

Definition at line 13 of file Length.php.

$unit [protected]

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

Definition at line 18 of file Length.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations