Merge pull request #5235 from atif-shaikh/CRM-5039MinorFixes
[civicrm-core.git] / CRM / Utils / Number.php
index f971be6a6b6dff602556580cbfe2e1055dd02c0f..ff9c4d66d0b30bc7a6e29163316aa507162df5d8 100644 (file)
@@ -1,12 +1,19 @@
 <?php
+
+/**
+ * Class CRM_Utils_Number
+ */
 class CRM_Utils_Number {
   /**
-   * Create a random number with a given precision
+   * Create a random number with a given precision.
+   *
+   * @param array $precision
+   *   (int $significantDigits, int $postDecimalDigits).
    *
-   * @param array $precision (int $significantDigits, int $postDecimalDigits)
+   * @return float
    * @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
    */
-  static function createRandomDecimal($precision) {
+  public static function createRandomDecimal($precision) {
     list ($sigFigs, $decFigs) = $precision;
     $rand = rand(0, pow(10, $sigFigs) - 1);
     return $rand / pow(10, $decFigs);
@@ -18,11 +25,12 @@ class CRM_Utils_Number {
    * and/or move the decimal place.
    *
    * @param int|float $keyValue
-   * @param array $precision (int $significantDigits, int $postDecimalDigits)
+   * @param array $precision
+   *   (int $significantDigits, int $postDecimalDigits).
    * @return float
    * @link https://dev.mysql.com/doc/refman/5.1/en/fixed-point-types.html
    */
-  static function createTruncatedDecimal($keyValue, $precision) {
+  public static function createTruncatedDecimal($keyValue, $precision) {
     list ($sigFigs, $decFigs) = $precision;
     $sign = ($keyValue < 0) ? '-1' : 1;
     $val = str_replace('.', '', abs($keyValue)); // ex: -123.456 ==> 123456
@@ -37,4 +45,5 @@ class CRM_Utils_Number {
       return $sign * $val;
     }
   }
-}
\ No newline at end of file
+
+}