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.
*
*
* @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)
* @param number $x Value to square (x)
* @return number The squared value (x^2)
*/
public static function square($x) {
public static function square($x)
{
return $x * $x;
}
@ -23,7 +25,8 @@ class BasicMath {
* @param callback $callback The function to apply to each array element before summing.
* @return number The sum.
*/
public static function sum(array $itemsToSum, $callback) {
public static function sum(array $itemsToSum, $callback)
{
$mappedItems = array_map($callback, $itemsToSum);
return array_sum($mappedItems);
}