diff --git a/classes/Convert.php b/classes/Convert.php index 3524d1c..5b70022 100644 --- a/classes/Convert.php +++ b/classes/Convert.php @@ -18,36 +18,12 @@ /** * Convert Class * - * Collection of statically called methods to help aid in converting formats. + * Collection of statically called methods to help aid in converting formats as + * well as distances. */ class Convert { - /** - * To JSON - * - * Encodes passed variable as JSON. - * - * Requires PHP 5 >= 5.2.0 or PECL json >= 1.2.0 - * - * @link http://json.org/ - * @link http://us.php.net/json_encode - * @link http://pecl.php.net/package/json - * - * @static - * @param mixed $variable variable to convert - * @return JSON encoded string - */ - public static function toJSON($variable) - { - if (JSON_AVAILABLE) - { - return json_encode($variable); - } - else - { - return '{ "status": "error", "message": "json_encode() not found" }'; - } - } + // {{{ Array to XML /** * Array to XML @@ -140,6 +116,55 @@ class Convert return $xml; } + + // }}} + // {{{ Meters to Miles + + /** + * Meters to Miles + * + * Converts meters to miles. + * + * @static + * @param mixed $meters meters to convert to miles + * @return mixed number of miles + */ + public static function metersToMiles($meters) + { + return $meters * 0.00062137119; + } + + // }}} + // {{{ To JSON + + /** + * To JSON + * + * Encodes passed variable as JSON. + * + * Requires PHP 5 >= 5.2.0 or PECL json >= 1.2.0 + * + * @link http://json.org/ + * @link http://us.php.net/json_encode + * @link http://pecl.php.net/package/json + * + * @static + * @param mixed $variable variable to convert + * @return JSON encoded string + */ + public static function toJSON($variable) + { + if (JSON_AVAILABLE) + { + return json_encode($variable); + } + else + { + return '{ "status": "error", "message": "json_encode() not found" }'; + } + } + + // }}} } ?> diff --git a/jar.php b/jar.php index 74abf96..96a80dd 100755 --- a/jar.php +++ b/jar.php @@ -1529,36 +1529,12 @@ class Controller extends Object /** * Convert Class * - * Collection of statically called methods to help aid in converting formats. + * Collection of statically called methods to help aid in converting formats as + * well as distances. */ class Convert { - /** - * To JSON - * - * Encodes passed variable as JSON. - * - * Requires PHP 5 >= 5.2.0 or PECL json >= 1.2.0 - * - * @link http://json.org/ - * @link http://us.php.net/json_encode - * @link http://pecl.php.net/package/json - * - * @static - * @param mixed $variable variable to convert - * @return JSON encoded string - */ - public static function toJSON($variable) - { - if (JSON_AVAILABLE) - { - return json_encode($variable); - } - else - { - return '{ "status": "error", "message": "json_encode() not found" }'; - } - } + // {{{ Array to XML /** * Array to XML @@ -1651,6 +1627,55 @@ class Convert return $xml; } + + // }}} + // {{{ Meters to Miles + + /** + * Meters to Miles + * + * Converts meters to miles. + * + * @static + * @param mixed $meters meters to convert to miles + * @return mixed number of miles + */ + public static function metersToMiles($meters) + { + return $meters * 0.00062137119; + } + + // }}} + // {{{ To JSON + + /** + * To JSON + * + * Encodes passed variable as JSON. + * + * Requires PHP 5 >= 5.2.0 or PECL json >= 1.2.0 + * + * @link http://json.org/ + * @link http://us.php.net/json_encode + * @link http://pecl.php.net/package/json + * + * @static + * @param mixed $variable variable to convert + * @return JSON encoded string + */ + public static function toJSON($variable) + { + if (JSON_AVAILABLE) + { + return json_encode($variable); + } + else + { + return '{ "status": "error", "message": "json_encode() not found" }'; + } + } + + // }}} } /**