mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
BasicMath matches all the other files
This commit is contained in:
@ -2,18 +2,20 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic math functions.
|
* Basic math functions.
|
||||||
*
|
*
|
||||||
* @author Jeff Moser <jeff@moserware.com>
|
* @author Jeff Moser <jeff@moserware.com>
|
||||||
* @copyright 2010 Jeff Moser
|
* @copyright 2010 Jeff Moser
|
||||||
*/
|
*/
|
||||||
class BasicMath {
|
class BasicMath
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Squares the input (x^2 = x * x)
|
* Squares the input (x^2 = x * x)
|
||||||
* @param number $x Value to square (x)
|
* @param number $x Value to square (x)
|
||||||
* @return number The squared value (x^2)
|
* @return number The squared value (x^2)
|
||||||
*/
|
*/
|
||||||
public static function square($x) {
|
public static function square($x)
|
||||||
|
{
|
||||||
return $x * $x;
|
return $x * $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +25,8 @@ class BasicMath {
|
|||||||
* @param callback $callback The function to apply to each array element before summing.
|
* @param callback $callback The function to apply to each array element before summing.
|
||||||
* @return number The sum.
|
* @return number The sum.
|
||||||
*/
|
*/
|
||||||
public static function sum(array $itemsToSum, $callback) {
|
public static function sum(array $itemsToSum, $callback)
|
||||||
|
{
|
||||||
$mappedItems = array_map($callback, $itemsToSum);
|
$mappedItems = array_map($callback, $itemsToSum);
|
||||||
return array_sum($mappedItems);
|
return array_sum($mappedItems);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user