mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 20:34:28 +00:00
Some minor documentation cleanup (e.g. converted C# comments to PHPDocumentor comments)
This commit is contained in:
@ -2,22 +2,30 @@
|
||||
/**
|
||||
* Basic math functions.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Math
|
||||
* @package PHPSkills
|
||||
* @author Jeff Moser <jeff@moserware.com>
|
||||
* @copyright 2010 Jeff Moser
|
||||
*/
|
||||
|
||||
/**
|
||||
* Squares the input (x^2 = x * x)
|
||||
* @param number $x Value to square (x)
|
||||
* @return number The squared value (x^2)
|
||||
*/
|
||||
function square($x)
|
||||
{
|
||||
return $x * $x;
|
||||
}
|
||||
|
||||
function sum(array $itemsToSum, $funcName )
|
||||
/**
|
||||
* Sums the items in $itemsToSum
|
||||
* @param array $itemsToSum The items to sum,
|
||||
* @param callback $callback The function to apply to each array element before summing.
|
||||
* @return number The sum.
|
||||
*/
|
||||
function sum(array $itemsToSum, $callback )
|
||||
{
|
||||
$mappedItems = array_map($funcName, $itemsToSum);
|
||||
$mappedItems = array_map($callback, $itemsToSum);
|
||||
return array_sum($mappedItems);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user