public static function setHAFAScoordinates($coordinate, $x, $y) { if ($y > $x) { // HAFAS bug, returns inverted lat/long $coordinate->x = $y; $coordinate->y = $x; } else { $coordinate->x = $x; $coordinate->y = $y; } return $coordinate; }