. * * This file is a part of iCalcreator. */ namespace Kigkonsult\Icalcreator\Util; use function abs; use function sprintf; use function rtrim; /** * iCalcreator geo support class * * @author Kjell-Inge Gustafsson, kigkonsult * @since 2.27.4 - 2019-07-02 */ class GeoFactory { /** * @var string GEO vars: output format for geo latitude and longitude (before rtrim) etc * @access public */ public static $geoLatFmt = '%09.6f'; public static $geoLongFmt = '%8.6f'; /** * Return formatted geo output * * @param float $ll * @param string $format * @return string * @access public */ public static function geo2str2( $ll, $format ) { if( 0.0 < $ll ) { $sign = Util::$PLUS; } else { $sign = ( 0.0 > $ll ) ? Util::$MINUS : null; } return rtrim( rtrim( $sign . sprintf( $format, abs( $ll )), Util::$ZERO ), Util::$DOT ); } }