Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function convertUnitOfMeasure($measurement, $startUnit, $resultUnit, $round = true)
 {
     if ($startUnit === self::DOTS_PER_INCH) {
         switch ($resultUnit) {
             case self::DOTS_PER_CENTIMETER:
                 $measurement *= 2.54;
                 break;
         }
     } elseif ($startUnit === self::DOTS_PER_CENTIMETER) {
         switch ($resultUnit) {
             case self::DOTS_PER_INCH:
                 $measurement /= 2.54;
                 break;
         }
     } elseif ($startUnit === self::UNIT_INCHES) {
         switch ($resultUnit) {
             case self::DOTS_PER_INCH:
                 $measurement *= $this->dpi;
                 break;
             case self::DOTS_PER_CENTIMETER:
                 $measurement *= 2.54 * $this->dpi;
                 break;
         }
     }
     return parent::convertUnitOfMeasure($measurement, $startUnit, $resultUnit, $round);
 }