Example #1
0
 /**
  * Indicates if this dimension equals the given dimension.
  *
  * @param Dimension $that
  *
  * @return bool
  */
 public function equals(Dimension $that)
 {
     if ($this == $that) {
         return true;
     }
     return $this->unit->equals($that->unit);
 }
Example #2
0
 public function to(Unit $unit)
 {
     if ($unit == $this->unit || $unit->equals($this->unit)) {
         return $this;
     }
     return self::valueOf($this->unit->getConverterTo($unit)->convert($this->value), $unit);
 }