/**
  * Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
  * @param HTMLPurifier_Length $l
  * @return int
  * @warning If both values are too large or small, this calculation will
  *          not work properly
  */
 public function compareTo($l)
 {
     if ($l === false) {
         return false;
     }
     if ($l->unit !== $this->unit) {
         $converter = new HTMLPurifier_UnitConverter();
         $l = $converter->convert($l, $this->unit);
         if ($l === false) {
             return false;
         }
     }
     return $this->n - $l->n;
 }
Esempio n. 2
0
 protected function assertSigFig($n, $sigfigs)
 {
     $converter = new HTMLPurifier_UnitConverter();
     $result = $converter->getSigFigs($n);
     $this->assertIdentical($result, $sigfigs);
 }