projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #5250 from jitendrapurohit/CRM-15934update
[civicrm-core.git]
/
CRM
/
Utils
/
Number.php
diff --git
a/CRM/Utils/Number.php
b/CRM/Utils/Number.php
index f971be6a6b6dff602556580cbfe2e1055dd02c0f..ff9c4d66d0b30bc7a6e29163316aa507162df5d8 100644
(file)
--- a/
CRM/Utils/Number.php
+++ b/
CRM/Utils/Number.php
@@
-1,12
+1,19
@@
<?php
<?php
+
+/**
+ * Class CRM_Utils_Number
+ */
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
*/
* @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);
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
* 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
*/
* @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
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;
}
}
return $sign * $val;
}
}
-}
\ No newline at end of file
+
+}