BasicMath matches all the other files

This commit is contained in:
Alexander Liljengård 2016-05-31 09:30:05 +02:00
parent 92648f3eaa
commit 14401b3ace

@ -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);
} }