Transport\Entity\Coordinate::floatToInt PHP Method

floatToInt() public static method

public static floatToInt ( $float )
    public static function floatToInt($float)
    {
        return sprintf('%01.6f', $float) * 1000000;
    }

Usage Example

Beispiel #1
0
 /**
  * {@inheritDoc}
  */
 public function toXml(\SimpleXMLElement $parent = null)
 {
     if (null !== $parent) {
         $xml = $parent->addChild('Address');
     } else {
         $xml = new \SimpleXMLElement('<Address />');
     }
     $xml['name'] = $this->name;
     // x and y inverted for HAFAS
     if ($this->coordinate->x) {
         $xml['y'] = Coordinate::floatToInt($this->coordinate->x);
     }
     if ($this->coordinate->y) {
         $xml['x'] = Coordinate::floatToInt($this->coordinate->y);
     }
     return $xml;
 }
All Usage Examples Of Transport\Entity\Coordinate::floatToInt