From b05dc318507182ef6fe72717bc0f9c9b5ba4bf65 Mon Sep 17 00:00:00 2001 From: oleibman Date: Tue, 20 Apr 2021 13:43:29 -0700 Subject: [PATCH] MathTrig - Change Names of funcWhatever to evaluate (#2008) * MathTrig - Change Names of funcWhatever to evaluate Per discussions while MathTrig was being broken up, this would help standardize the code. That idea was adopted partway through the breakup. This PR applies that standardization to the earlier efforts. A similar effort is required for DateTime; that will come later. This PR replaces #2006. The only 2 remaining funcWhatevers in MathTrig are both in SUM, which required two different methods depending on whether or not string parameters were to be ignored. It seems appropriate to leave those method names non-standardized in order to require a decision about which is to be used if they are invoked internally. 3 Phpstan grandfathered errors were eliminated as part of this change, and its baseline has changed accordingly. Co-authored-by: Mark Baker --- phpstan-baseline.neon | 15 - .../Calculation/Calculation.php | 94 +++---- .../Calculation/Database/DProduct.php | 2 +- src/PhpSpreadsheet/Calculation/MathTrig.php | 266 +++++++++--------- .../Calculation/MathTrig/Acos.php | 2 +- .../Calculation/MathTrig/Acosh.php | 4 +- .../Calculation/MathTrig/Acot.php | 2 +- .../Calculation/MathTrig/Acoth.php | 2 +- .../Calculation/MathTrig/Asin.php | 2 +- .../Calculation/MathTrig/Asinh.php | 2 +- .../Calculation/MathTrig/Atan.php | 2 +- .../Calculation/MathTrig/Atan2.php | 2 +- .../Calculation/MathTrig/Atanh.php | 2 +- .../Calculation/MathTrig/Base.php | 2 +- .../Calculation/MathTrig/Ceiling.php | 2 +- .../Calculation/MathTrig/CeilingMath.php | 2 +- .../Calculation/MathTrig/CeilingPrecise.php | 2 +- .../Calculation/MathTrig/Combinations.php | 4 +- .../Calculation/MathTrig/Cos.php | 2 +- .../Calculation/MathTrig/Cosh.php | 2 +- .../Calculation/MathTrig/Cot.php | 2 +- .../Calculation/MathTrig/Coth.php | 2 +- .../Calculation/MathTrig/Csc.php | 2 +- .../Calculation/MathTrig/Csch.php | 2 +- .../Calculation/MathTrig/Even.php | 2 +- .../Calculation/MathTrig/Fact.php | 2 +- .../Calculation/MathTrig/Floor.php | 6 +- .../Calculation/MathTrig/FloorMath.php | 2 +- .../Calculation/MathTrig/FloorPrecise.php | 2 +- .../Calculation/MathTrig/IntClass.php | 2 +- .../Calculation/MathTrig/Lcm.php | 2 +- .../Calculation/MathTrig/MatrixFunctions.php | 2 +- .../Calculation/MathTrig/Mround.php | 6 +- .../Calculation/MathTrig/Multinomial.php | 6 +- .../Calculation/MathTrig/Odd.php | 2 +- .../Calculation/MathTrig/Product.php | 2 +- .../Calculation/MathTrig/Quotient.php | 2 +- .../Calculation/MathTrig/Roman.php | 2 +- .../Calculation/MathTrig/Round.php | 2 +- .../Calculation/MathTrig/RoundDown.php | 2 +- .../Calculation/MathTrig/RoundUp.php | 2 +- .../Calculation/MathTrig/Sec.php | 2 +- .../Calculation/MathTrig/Sech.php | 2 +- .../Calculation/MathTrig/SeriesSum.php | 2 +- .../Calculation/MathTrig/Sign.php | 2 +- .../Calculation/MathTrig/Sin.php | 2 +- .../Calculation/MathTrig/Sinh.php | 2 +- .../Calculation/MathTrig/Subtotal.php | 4 +- .../Calculation/MathTrig/SumProduct.php | 2 +- .../Calculation/MathTrig/Tan.php | 2 +- .../Calculation/MathTrig/Tanh.php | 2 +- .../Calculation/MathTrig/Trunc.php | 2 +- .../Calculation/Statistical.php | 2 +- .../Statistical/Distributions/Poisson.php | 4 +- .../Calculation/Statistical/Permutations.php | 2 +- .../Calculation/TextData/Format.php | 4 +- .../Functions/MathTrig/MUnitTest.php | 8 +- 57 files changed, 249 insertions(+), 262 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 88a98368..6390e0fc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1725,21 +1725,6 @@ parameters: count: 2 path: src/PhpSpreadsheet/Calculation/TextData/Extract.php - - - message: "#^Parameter \\#1 \\$number of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\MathTrig\\\\Mround\\:\\:funcMround\\(\\) expects float, float\\|int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php - - - - message: "#^Parameter \\#1 \\$number of function floor expects float, float\\|int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php - - - - message: "#^Parameter \\#1 \\$number of function round expects float, float\\|int\\|string given\\.$#" - count: 1 - path: src/PhpSpreadsheet/Calculation/TextData/Format.php - - message: "#^Cannot cast array\\|float\\|int\\|string to float\\.$#" count: 1 diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index e1deeb6a..ec85df69 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -243,22 +243,22 @@ class Calculation ], 'ACOS' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Acos::class, 'funcAcos'], + 'functionCall' => [MathTrig\Acos::class, 'evaluate'], 'argumentCount' => '1', ], 'ACOSH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Acosh::class, 'funcAcosh'], + 'functionCall' => [MathTrig\Acosh::class, 'evaluate'], 'argumentCount' => '1', ], 'ACOT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Acot::class, 'funcAcot'], + 'functionCall' => [MathTrig\Acot::class, 'evaluate'], 'argumentCount' => '1', ], 'ACOTH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Acoth::class, 'funcAcoth'], + 'functionCall' => [MathTrig\Acoth::class, 'evaluate'], 'argumentCount' => '1', ], 'ADDRESS' => [ @@ -303,27 +303,27 @@ class Calculation ], 'ASIN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Asin::class, 'funcAsin'], + 'functionCall' => [MathTrig\Asin::class, 'evaluate'], 'argumentCount' => '1', ], 'ASINH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Asinh::class, 'funcAsinh'], + 'functionCall' => [MathTrig\Asinh::class, 'evaluate'], 'argumentCount' => '1', ], 'ATAN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Atan::class, 'funcAtan'], + 'functionCall' => [MathTrig\Atan::class, 'evaluate'], 'argumentCount' => '1', ], 'ATAN2' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Atan2::class, 'funcAtan2'], + 'functionCall' => [MathTrig\Atan2::class, 'evaluate'], 'argumentCount' => '2', ], 'ATANH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Atanh::class, 'funcAtanh'], + 'functionCall' => [MathTrig\Atanh::class, 'evaluate'], 'argumentCount' => '1', ], 'AVEDEV' => [ @@ -358,7 +358,7 @@ class Calculation ], 'BASE' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Base::class, 'funcBase'], + 'functionCall' => [MathTrig\Base::class, 'evaluate'], 'argumentCount' => '2,3', ], 'BESSELI' => [ @@ -463,17 +463,17 @@ class Calculation ], 'CEILING' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Ceiling::class, 'funcCeiling'], + 'functionCall' => [MathTrig\Ceiling::class, 'evaluate'], 'argumentCount' => '1-2', // 2 for Excel, 1-2 for Ods/Gnumeric ], 'CEILING.MATH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\CeilingMath::class, 'funcCeilingMath'], + 'functionCall' => [MathTrig\CeilingMath::class, 'evaluate'], 'argumentCount' => '1-3', ], 'CEILING.PRECISE' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\CeilingPrecise::class, 'funcCeilingPrecise'], + 'functionCall' => [MathTrig\CeilingPrecise::class, 'evaluate'], 'argumentCount' => '1,2', ], 'CELL' => [ @@ -605,22 +605,22 @@ class Calculation ], 'COS' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Cos::class, 'funcCos'], + 'functionCall' => [MathTrig\Cos::class, 'evaluate'], 'argumentCount' => '1', ], 'COSH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Cosh::class, 'funcCosh'], + 'functionCall' => [MathTrig\Cosh::class, 'evaluate'], 'argumentCount' => '1', ], 'COT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Cot::class, 'funcCot'], + 'functionCall' => [MathTrig\Cot::class, 'evaluate'], 'argumentCount' => '1', ], 'COTH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Coth::class, 'funcCoth'], + 'functionCall' => [MathTrig\Coth::class, 'evaluate'], 'argumentCount' => '1', ], 'COUNT' => [ @@ -700,12 +700,12 @@ class Calculation ], 'CSC' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Csc::class, 'funcCsc'], + 'functionCall' => [MathTrig\Csc::class, 'evaluate'], 'argumentCount' => '1', ], 'CSCH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Csch::class, 'funcCsch'], + 'functionCall' => [MathTrig\Csch::class, 'evaluate'], 'argumentCount' => '1', ], 'CUBEKPIMEMBER' => [ @@ -965,7 +965,7 @@ class Calculation ], 'EVEN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Even::class, 'funcEven'], + 'functionCall' => [MathTrig\Even::class, 'evaluate'], 'argumentCount' => '1', ], 'EXACT' => [ @@ -990,7 +990,7 @@ class Calculation ], 'FACT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Fact::class, 'funcFact'], + 'functionCall' => [MathTrig\Fact::class, 'evaluate'], 'argumentCount' => '1', ], 'FACTDOUBLE' => [ @@ -1070,17 +1070,17 @@ class Calculation ], 'FLOOR' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Floor::class, 'funcFloor'], + 'functionCall' => [MathTrig\Floor::class, 'evaluate'], 'argumentCount' => '1-2', // Excel requries 2, Ods/Gnumeric 1-2 ], 'FLOOR.MATH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\FloorMath::class, 'funcFloorMath'], + 'functionCall' => [MathTrig\FloorMath::class, 'evaluate'], 'argumentCount' => '1-3', ], 'FLOOR.PRECISE' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\FloorPrecise::class, 'funcFloorPrecise'], + 'functionCall' => [MathTrig\FloorPrecise::class, 'evaluate'], 'argumentCount' => '1-2', ], 'FORECAST' => [ @@ -1419,7 +1419,7 @@ class Calculation ], 'INT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\IntClass::class, 'funcInt'], + 'functionCall' => [MathTrig\IntClass::class, 'evaluate'], 'argumentCount' => '1', ], 'INTERCEPT' => [ @@ -1536,7 +1536,7 @@ class Calculation ], 'LCM' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Lcm::class, 'funcLcm'], + 'functionCall' => [MathTrig\Lcm::class, 'evaluate'], 'argumentCount' => '1+', ], 'LEFT' => [ @@ -1726,17 +1726,17 @@ class Calculation ], 'MROUND' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Mround::class, 'funcMround'], + 'functionCall' => [MathTrig\Mround::class, 'evaluate'], 'argumentCount' => '2', ], 'MULTINOMIAL' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Multinomial::class, 'funcMultinomial'], + 'functionCall' => [MathTrig\Multinomial::class, 'evaluate'], 'argumentCount' => '1+', ], 'MUNIT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\MatrixFunctions::class, 'funcMUnit'], + 'functionCall' => [MathTrig\MatrixFunctions::class, 'identity'], 'argumentCount' => '1', ], 'N' => [ @@ -1856,7 +1856,7 @@ class Calculation ], 'ODD' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Odd::class, 'funcOdd'], + 'functionCall' => [MathTrig\Odd::class, 'evaluate'], 'argumentCount' => '1', ], 'ODDFPRICE' => [ @@ -2003,7 +2003,7 @@ class Calculation ], 'PRODUCT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Product::class, 'funcProduct'], + 'functionCall' => [MathTrig\Product::class, 'evaluate'], 'argumentCount' => '1+', ], 'PROPER' => [ @@ -2033,7 +2033,7 @@ class Calculation ], 'QUOTIENT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Quotient::class, 'funcQuotient'], + 'functionCall' => [MathTrig\Quotient::class, 'evaluate'], 'argumentCount' => '2', ], 'RADIANS' => [ @@ -2108,22 +2108,22 @@ class Calculation ], 'ROMAN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Roman::class, 'funcRoman'], + 'functionCall' => [MathTrig\Roman::class, 'evaluate'], 'argumentCount' => '1,2', ], 'ROUND' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Round::class, 'builtinROUND'], + 'functionCall' => [MathTrig\Round::class, 'evaluate'], 'argumentCount' => '2', ], 'ROUNDDOWN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\RoundDown::class, 'funcRoundDown'], + 'functionCall' => [MathTrig\RoundDown::class, 'evaluate'], 'argumentCount' => '2', ], 'ROUNDUP' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\RoundUp::class, 'funcRoundUp'], + 'functionCall' => [MathTrig\RoundUp::class, 'evaluate'], 'argumentCount' => '2', ], 'ROW' => [ @@ -2165,12 +2165,12 @@ class Calculation ], 'SEC' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Sec::class, 'funcSec'], + 'functionCall' => [MathTrig\Sec::class, 'evaluate'], 'argumentCount' => '1', ], 'SECH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Sech::class, 'funcSech'], + 'functionCall' => [MathTrig\Sech::class, 'evaluate'], 'argumentCount' => '1', ], 'SECOND' => [ @@ -2185,7 +2185,7 @@ class Calculation ], 'SERIESSUM' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\SeriesSum::class, 'funcSeriesSum'], + 'functionCall' => [MathTrig\SeriesSum::class, 'evaluate'], 'argumentCount' => '4', ], 'SHEET' => [ @@ -2200,17 +2200,17 @@ class Calculation ], 'SIGN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Sign::class, 'funcSign'], + 'functionCall' => [MathTrig\Sign::class, 'evaluate'], 'argumentCount' => '1', ], 'SIN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Sin::class, 'funcSin'], + 'functionCall' => [MathTrig\Sin::class, 'evaluate'], 'argumentCount' => '1', ], 'SINH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Sinh::class, 'funcSinh'], + 'functionCall' => [MathTrig\Sinh::class, 'evaluate'], 'argumentCount' => '1', ], 'SKEW' => [ @@ -2305,7 +2305,7 @@ class Calculation ], 'SUBTOTAL' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Subtotal::class, 'funcSubtotal'], + 'functionCall' => [MathTrig\Subtotal::class, 'evaluate'], 'argumentCount' => '2+', 'passCellReference' => true, ], @@ -2326,7 +2326,7 @@ class Calculation ], 'SUMPRODUCT' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\SumProduct::class, 'funcSumProduct'], + 'functionCall' => [MathTrig\SumProduct::class, 'evaluate'], 'argumentCount' => '1+', ], 'SUMSQ' => [ @@ -2366,12 +2366,12 @@ class Calculation ], 'TAN' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Tan::class, 'funcTan'], + 'functionCall' => [MathTrig\Tan::class, 'evaluate'], 'argumentCount' => '1', ], 'TANH' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Tanh::class, 'funcTanh'], + 'functionCall' => [MathTrig\Tanh::class, 'evaluate'], 'argumentCount' => '1', ], 'TBILLEQ' => [ @@ -2476,7 +2476,7 @@ class Calculation ], 'TRUNC' => [ 'category' => Category::CATEGORY_MATH_AND_TRIG, - 'functionCall' => [MathTrig\Trunc::class, 'funcTrunc'], + 'functionCall' => [MathTrig\Trunc::class, 'evaluate'], 'argumentCount' => '1,2', ], 'TTEST' => [ diff --git a/src/PhpSpreadsheet/Calculation/Database/DProduct.php b/src/PhpSpreadsheet/Calculation/Database/DProduct.php index 4515da24..2e10fb5f 100644 --- a/src/PhpSpreadsheet/Calculation/Database/DProduct.php +++ b/src/PhpSpreadsheet/Calculation/Database/DProduct.php @@ -38,7 +38,7 @@ class DProduct extends DatabaseAbstract return null; } - return MathTrig\Product::funcProduct( + return MathTrig\Product::evaluate( self::getFilteredColumn($database, $field, $criteria) ); } diff --git a/src/PhpSpreadsheet/Calculation/MathTrig.php b/src/PhpSpreadsheet/Calculation/MathTrig.php index 131f1dbb..121efde5 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig.php @@ -44,8 +44,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Atan2::funcAtan2() - * Use the funcAtan2 method in the MathTrig\Atan2 class instead + * @See MathTrig\Atan2::evaluate() + * Use the evaluate method in the MathTrig\Atan2 class instead * * @param float $xCoordinate the x-coordinate of the point * @param float $yCoordinate the y-coordinate of the point @@ -54,7 +54,7 @@ class MathTrig */ public static function ATAN2($xCoordinate = null, $yCoordinate = null) { - return MathTrig\Atan2::funcAtan2($xCoordinate, $yCoordinate); + return MathTrig\Atan2::evaluate($xCoordinate, $yCoordinate); } /** @@ -67,8 +67,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Base::funcBase() - * Use the funcBase method in the MathTrig\Base class instead + * @See MathTrig\Base::evaluate() + * Use the evaluate method in the MathTrig\Base class instead * * @param float $number * @param float $radix @@ -78,7 +78,7 @@ class MathTrig */ public static function BASE($number, $radix, $minLength = null) { - return MathTrig\Base::funcBase($number, $radix, $minLength); + return MathTrig\Base::evaluate($number, $radix, $minLength); } /** @@ -94,8 +94,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\Ceiling::funcCeiling() - * Use the funcCeiling() method in the MathTrig\Ceiling class instead + * @see MathTrig\Ceiling::evaluate() + * Use the evaluate() method in the MathTrig\Ceiling class instead * * @param float $number the number you want to round * @param float $significance the multiple to which you want to round @@ -104,7 +104,7 @@ class MathTrig */ public static function CEILING($number, $significance = null) { - return MathTrig\Ceiling::funcCeiling($number, $significance); + return MathTrig\Ceiling::evaluate($number, $significance); } /** @@ -145,8 +145,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @see MathTrig\Even::funcEven() - * Use the funcEven() method in the MathTrig\Even class instead + * @see MathTrig\Even::evaluate() + * Use the evaluate() method in the MathTrig\Even class instead * * @param float $number Number to round * @@ -154,7 +154,7 @@ class MathTrig */ public static function EVEN($number) { - return MathTrig\Even::funcEven($number); + return MathTrig\Even::evaluate($number); } /** @@ -163,7 +163,7 @@ class MathTrig * @Deprecated 1.18.0 * * @see MathTrig\Helpers::getEven() - * Use the funcEven() method in the MathTrig\Helpers class instead + * Use the evaluate() method in the MathTrig\Helpers class instead */ public static function getEven(float $number): int { @@ -181,8 +181,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @see MathTrig\Fact::funcFact() - * Use the funcFact() method in the MathTrig\Fact class instead + * @see MathTrig\Fact::evaluate() + * Use the evaluate() method in the MathTrig\Fact class instead * * @param float $factVal Factorial Value * @@ -190,7 +190,7 @@ class MathTrig */ public static function FACT($factVal) { - return MathTrig\Fact::funcFact($factVal); + return MathTrig\Fact::evaluate($factVal); } /** @@ -225,8 +225,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\Floor::funcFloor() - * Use the funcFloor() method in the MathTrig\Floor class instead + * @see MathTrig\Floor::evaluate() + * Use the evaluate() method in the MathTrig\Floor class instead * * @param float $number Number to round * @param float $significance Significance @@ -235,7 +235,7 @@ class MathTrig */ public static function FLOOR($number, $significance = null) { - return MathTrig\Floor::funcFloor($number, $significance); + return MathTrig\Floor::evaluate($number, $significance); } /** @@ -248,8 +248,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\FloorMath::funcFloorMath() - * Use the funcFloorMath() method in the MathTrig\FloorMath class instead + * @see MathTrig\FloorMath::evaluate() + * Use the evaluate() method in the MathTrig\FloorMath class instead * * @param float $number Number to round * @param float $significance Significance @@ -259,7 +259,7 @@ class MathTrig */ public static function FLOORMATH($number, $significance = null, $mode = 0) { - return MathTrig\FloorMath::funcFloorMath($number, $significance, $mode); + return MathTrig\FloorMath::evaluate($number, $significance, $mode); } /** @@ -272,8 +272,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\FloorPrecise::funcFloorPrecise() - * Use the funcFloorPrecise() method in the MathTrig\FloorPrecise class instead + * @see MathTrig\FloorPrecise::evaluate() + * Use the evaluate() method in the MathTrig\FloorPrecise class instead * * @param float $number Number to round * @param float $significance Significance @@ -282,7 +282,7 @@ class MathTrig */ public static function FLOORPRECISE($number, $significance = 1) { - return MathTrig\FloorPrecise::funcFloorPrecise($number, $significance); + return MathTrig\FloorPrecise::evaluate($number, $significance); } /** @@ -295,8 +295,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\IntClass::funcInt() - * Use the funcInt() method in the MathTrig\IntClass class instead + * @see MathTrig\IntClass::evaluate() + * Use the evaluate() method in the MathTrig\IntClass class instead * * @param float $number Number to cast to an integer * @@ -304,7 +304,7 @@ class MathTrig */ public static function INT($number) { - return MathTrig\IntClass::funcInt($number); + return MathTrig\IntClass::evaluate($number); } /** @@ -344,8 +344,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @see MathTrig\Lcm::funcLcm() - * Use the funcLcm() method in the MathTrig\Lcm class instead + * @see MathTrig\Lcm::evaluate() + * Use the evaluate() method in the MathTrig\Lcm class instead * * @param mixed ...$args Data values * @@ -353,7 +353,7 @@ class MathTrig */ public static function LCM(...$args) { - return MathTrig\Lcm::funcLcm(...$args); + return MathTrig\Lcm::evaluate(...$args); } /** @@ -466,8 +466,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\Mround::funcMround() - * Use the funcMround() method in the MathTrig\Mround class instead + * @see MathTrig\Mround::evaluate() + * Use the evaluate() method in the MathTrig\Mround class instead * * @param float $number Number to round * @param int $multiple Multiple to which you want to round $number @@ -476,7 +476,7 @@ class MathTrig */ public static function MROUND($number, $multiple) { - return MathTrig\Mround::funcMround($number, $multiple); + return MathTrig\Mround::evaluate($number, $multiple); } /** @@ -486,8 +486,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Multinomial::funcMultinomial() - * Use the funcMultinomial method in the MathTrig\Multinomial class instead + * @See MathTrig\Multinomial::evaluate() + * Use the evaluate method in the MathTrig\Multinomial class instead * * @param mixed[] $args An array of mixed values for the Data Series * @@ -495,7 +495,7 @@ class MathTrig */ public static function MULTINOMIAL(...$args) { - return MathTrig\Multinomial::funcMultinomial(...$args); + return MathTrig\Multinomial::evaluate(...$args); } /** @@ -505,8 +505,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Odd::funcOdd() - * Use the funcOdd method in the MathTrig\Odd class instead + * @See MathTrig\Odd::evaluate() + * Use the evaluate method in the MathTrig\Odd class instead * * @param float $number Number to round * @@ -514,7 +514,7 @@ class MathTrig */ public static function ODD($number) { - return MathTrig\Odd::funcOdd($number); + return MathTrig\Odd::evaluate($number); } /** @@ -544,8 +544,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Product::funcProduct() - * Use the funcProduct method in the MathTrig\Product class instead + * @See MathTrig\Product::evaluate() + * Use the evaluate method in the MathTrig\Product class instead * * Excel Function: * PRODUCT(value1[,value2[, ...]]) @@ -556,7 +556,7 @@ class MathTrig */ public static function PRODUCT(...$args) { - return MathTrig\Product::funcProduct(...$args); + return MathTrig\Product::evaluate(...$args); } /** @@ -567,8 +567,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Quotient::funcQuotient() - * Use the funcQuotient method in the MathTrig\Quotient class instead + * @See MathTrig\Quotient::evaluate() + * Use the evaluate method in the MathTrig\Quotient class instead * * Excel Function: * QUOTIENT(value1[,value2[, ...]]) @@ -580,7 +580,7 @@ class MathTrig */ public static function QUOTIENT($numerator, $denominator) { - return MathTrig\Quotient::funcQuotient($numerator, $denominator); + return MathTrig\Quotient::evaluate($numerator, $denominator); } /** @@ -608,8 +608,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @Ssee MathTrig\Roman::funcRoman() - * Use the funcRoman() method in the MathTrig\Roman class instead + * @Ssee MathTrig\Roman::evaluate() + * Use the evaluate() method in the MathTrig\Roman class instead * * @param mixed $aValue Number to convert * @param mixed $style Number indicating one of five possible forms @@ -618,7 +618,7 @@ class MathTrig */ public static function ROMAN($aValue, $style = 0) { - return MathTrig\Roman::funcRoman($aValue, $style); + return MathTrig\Roman::evaluate($aValue, $style); } /** @@ -628,8 +628,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @See MathTrig\RoundUp::funcRoundUp() - * Use the funcRoundUp() method in the MathTrig\RoundUp class instead + * @See MathTrig\RoundUp::evaluate() + * Use the evaluate() method in the MathTrig\RoundUp class instead * * @param float $number Number to round * @param int $digits Number of digits to which you want to round $number @@ -638,7 +638,7 @@ class MathTrig */ public static function ROUNDUP($number, $digits) { - return MathTrig\RoundUp::funcRoundUp($number, $digits); + return MathTrig\RoundUp::evaluate($number, $digits); } /** @@ -648,8 +648,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @See MathTrig\RoundDown::funcRoundDown() - * Use the funcRoundDown() method in the MathTrig\RoundDown class instead + * @See MathTrig\RoundDown::evaluate() + * Use the evaluate() method in the MathTrig\RoundDown class instead * * @param float $number Number to round * @param int $digits Number of digits to which you want to round $number @@ -658,7 +658,7 @@ class MathTrig */ public static function ROUNDDOWN($number, $digits) { - return MathTrig\RoundDown::funcRoundDown($number, $digits); + return MathTrig\RoundDown::evaluate($number, $digits); } /** @@ -668,8 +668,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\SeriesSum::funcSeriesSum() - * Use the funcSeriesSum method in the MathTrig\SeriesSum class instead + * @See MathTrig\SeriesSum::evaluate() + * Use the evaluate method in the MathTrig\SeriesSum class instead * * @param mixed $x Input value * @param mixed $n Initial power @@ -680,7 +680,7 @@ class MathTrig */ public static function SERIESSUM($x, $n, $m, ...$args) { - return MathTrig\SeriesSum::funcSeriesSum($x, $n, $m, ...$args); + return MathTrig\SeriesSum::evaluate($x, $n, $m, ...$args); } /** @@ -691,8 +691,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Sign::funcSign() - * Use the funcSign method in the MathTrig\Sign class instead + * @See MathTrig\Sign::evaluate() + * Use the evaluate method in the MathTrig\Sign class instead * * @param float $number Number to round * @@ -700,7 +700,7 @@ class MathTrig */ public static function SIGN($number) { - return MathTrig\Sign::funcSign($number); + return MathTrig\Sign::evaluate($number); } /** @@ -742,8 +742,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Subtotal::funcSubtotal() - * Use the funcSubtotal method in the MathTrig\Subtotal class instead + * @See MathTrig\Subtotal::evaluate() + * Use the evaluate method in the MathTrig\Subtotal class instead * * @param int $functionType * A number 1 to 11 that specifies which function to @@ -758,7 +758,7 @@ class MathTrig */ public static function SUBTOTAL($functionType, ...$args) { - return MathTrig\Subtotal::funcSubtotal($functionType, ...$args); + return MathTrig\Subtotal::evaluate($functionType, ...$args); } /** @@ -837,8 +837,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\SumProduct::funcSumProduct() - * Use the funcSumProduct method in the MathTrig\SumProduct class instead + * @See MathTrig\SumProduct::evaluate() + * Use the evaluate method in the MathTrig\SumProduct class instead * * @param mixed ...$args Data values * @@ -846,7 +846,7 @@ class MathTrig */ public static function SUMPRODUCT(...$args) { - return MathTrig\SumProduct::funcSumProduct(...$args); + return MathTrig\SumProduct::evaluate(...$args); } /** @@ -932,8 +932,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @see MathTrig\Trunc::funcTrunc() - * Use the funcTrunc() method in the MathTrig\Trunc class instead + * @see MathTrig\Trunc::evaluate() + * Use the evaluate() method in the MathTrig\Trunc class instead * * @param float $value * @param int $digits @@ -942,7 +942,7 @@ class MathTrig */ public static function TRUNC($value = 0, $digits = 0) { - return MathTrig\Trunc::funcTrunc($value, $digits); + return MathTrig\Trunc::evaluate($value, $digits); } /** @@ -952,8 +952,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Sec::funcSec() - * Use the funcSec method in the MathTrig\Sec class instead + * @See MathTrig\Sec::evaluate() + * Use the evaluate method in the MathTrig\Sec class instead * * @param float $angle Number * @@ -961,7 +961,7 @@ class MathTrig */ public static function SEC($angle) { - return MathTrig\Sec::funcSec($angle); + return MathTrig\Sec::evaluate($angle); } /** @@ -971,8 +971,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\SecH::funcSech() - * Use the funcSecH method in the MathTrig\Sech class instead + * @See MathTrig\SecH::evaluate() + * Use the evaluate method in the MathTrig\Sech class instead * * @param float $angle Number * @@ -980,7 +980,7 @@ class MathTrig */ public static function SECH($angle) { - return MathTrig\Sech::funcSech($angle); + return MathTrig\Sech::evaluate($angle); } /** @@ -990,8 +990,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Csc::funcCsc() - * Use the funcCsc method in the MathTrig\Csc class instead + * @See MathTrig\Csc::evaluate() + * Use the evaluate method in the MathTrig\Csc class instead * * @param float $angle Number * @@ -999,7 +999,7 @@ class MathTrig */ public static function CSC($angle) { - return MathTrig\Csc::funcCsc($angle); + return MathTrig\Csc::evaluate($angle); } /** @@ -1009,8 +1009,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Csch::funcCsch() - * Use the funcCsch method in the MathTrig\Csch class instead + * @See MathTrig\Csch::evaluate() + * Use the evaluate method in the MathTrig\Csch class instead * * @param float $angle Number * @@ -1018,7 +1018,7 @@ class MathTrig */ public static function CSCH($angle) { - return MathTrig\Csch::funcCsch($angle); + return MathTrig\Csch::evaluate($angle); } /** @@ -1028,8 +1028,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Cot::funcCot() - * Use the funcCot method in the MathTrig\Cot class instead + * @See MathTrig\Cot::evaluate() + * Use the evaluate method in the MathTrig\Cot class instead * * @param float $angle Number * @@ -1037,7 +1037,7 @@ class MathTrig */ public static function COT($angle) { - return MathTrig\Cot::funcCot($angle); + return MathTrig\Cot::evaluate($angle); } /** @@ -1047,8 +1047,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Coth::funcCoth() - * Use the funcCoth method in the MathTrig\Coth class instead + * @See MathTrig\Coth::evaluate() + * Use the evaluate method in the MathTrig\Coth class instead * * @param float $angle Number * @@ -1056,7 +1056,7 @@ class MathTrig */ public static function COTH($angle) { - return MathTrig\Coth::funcCoth($angle); + return MathTrig\Coth::evaluate($angle); } /** @@ -1066,8 +1066,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Acot::funcAcot() - * Use the funcAcot method in the MathTrig\Acot class instead + * @See MathTrig\Acot::evaluate() + * Use the evaluate method in the MathTrig\Acot class instead * * @param float $number Number * @@ -1075,7 +1075,7 @@ class MathTrig */ public static function ACOT($number) { - return MathTrig\Acot::funcAcot($number); + return MathTrig\Acot::evaluate($number); } /** @@ -1102,8 +1102,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Acoth::funcAcoth() - * Use the funcAcoth method in the MathTrig\Acoth class instead + * @See MathTrig\Acoth::evaluate() + * Use the evaluate method in the MathTrig\Acoth class instead * * @param float $number Number * @@ -1111,7 +1111,7 @@ class MathTrig */ public static function ACOTH($number) { - return MathTrig\Acoth::funcAcoth($number); + return MathTrig\Acoth::evaluate($number); } /** @@ -1121,8 +1121,8 @@ class MathTrig * * @Deprecated 1.17.0 * - * @See MathTrig\Round::builtinROUND() - * Use the builtinRound() method in the MathTrig\Round class instead + * @See MathTrig\Round::evaluate() + * Use the evaluate() method in the MathTrig\Round class instead * * @param mixed $number Should be numeric * @param mixed $precision Should be int @@ -1131,7 +1131,7 @@ class MathTrig */ public static function builtinROUND($number, $precision) { - return MathTrig\Round::builtinRound($number, $precision); + return MathTrig\Round::evaluate($number, $precision); } /** @@ -1158,8 +1158,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Acos::funcAcos() - * Use the funcAcos method in the MathTrig\Acos class instead + * @See MathTrig\Acos::evaluate() + * Use the evaluate method in the MathTrig\Acos class instead * * Returns the result of builtin function acos after validating args. * @@ -1169,7 +1169,7 @@ class MathTrig */ public static function builtinACOS($number) { - return MathTrig\Acos::funcAcos($number); + return MathTrig\Acos::evaluate($number); } /** @@ -1179,8 +1179,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Acosh::funcAcosh() - * Use the funcAcosh method in the MathTrig\Acosh class instead + * @See MathTrig\Acosh::evaluate() + * Use the evaluate method in the MathTrig\Acosh class instead * * @param mixed $number Should be numeric * @@ -1188,7 +1188,7 @@ class MathTrig */ public static function builtinACOSH($number) { - return MathTrig\Acosh::funcAcosh($number); + return MathTrig\Acosh::evaluate($number); } /** @@ -1198,8 +1198,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Asin::funcAsin() - * Use the funcAsin method in the MathTrig\Asin class instead + * @See MathTrig\Asin::evaluate() + * Use the evaluate method in the MathTrig\Asin class instead * * @param mixed $number Should be numeric * @@ -1207,7 +1207,7 @@ class MathTrig */ public static function builtinASIN($number) { - return MathTrig\Asin::funcAsin($number); + return MathTrig\Asin::evaluate($number); } /** @@ -1217,8 +1217,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Asinh::funcAsinh() - * Use the funcAsinh method in the MathTrig\Asinh class instead + * @See MathTrig\Asinh::evaluate() + * Use the evaluate method in the MathTrig\Asinh class instead * * @param mixed $number Should be numeric * @@ -1226,7 +1226,7 @@ class MathTrig */ public static function builtinASINH($number) { - return MathTrig\Asinh::funcAsinh($number); + return MathTrig\Asinh::evaluate($number); } /** @@ -1236,8 +1236,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Atan::funcAtan() - * Use the funcAtan method in the MathTrig\Atan class instead + * @See MathTrig\Atan::evaluate() + * Use the evaluate method in the MathTrig\Atan class instead * * @param mixed $number Should be numeric * @@ -1245,7 +1245,7 @@ class MathTrig */ public static function builtinATAN($number) { - return MathTrig\Atan::funcAtan($number); + return MathTrig\Atan::evaluate($number); } /** @@ -1255,8 +1255,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Atanh::funcAtanh() - * Use the funcAtanh method in the MathTrig\Atanh class instead + * @See MathTrig\Atanh::evaluate() + * Use the evaluate method in the MathTrig\Atanh class instead * * @param mixed $number Should be numeric * @@ -1264,7 +1264,7 @@ class MathTrig */ public static function builtinATANH($number) { - return MathTrig\Atanh::funcAtanh($number); + return MathTrig\Atanh::evaluate($number); } /** @@ -1274,8 +1274,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Cos::funcCos() - * Use the funcCos method in the MathTrig\Cos class instead + * @See MathTrig\Cos::evaluate() + * Use the evaluate method in the MathTrig\Cos class instead * * @param mixed $number Should be numeric * @@ -1283,7 +1283,7 @@ class MathTrig */ public static function builtinCOS($number) { - return MathTrig\Cos::funcCos($number); + return MathTrig\Cos::evaluate($number); } /** @@ -1293,8 +1293,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Cosh::funcCosh() - * Use the funcCosh method in the MathTrig\Cosh class instead + * @See MathTrig\Cosh::evaluate() + * Use the evaluate method in the MathTrig\Cosh class instead * * @param mixed $number Should be numeric * @@ -1302,7 +1302,7 @@ class MathTrig */ public static function builtinCOSH($number) { - return MathTrig\Cosh::funcCosh($number); + return MathTrig\Cosh::evaluate($number); } /** @@ -1407,8 +1407,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Sin::funcSin() - * Use the funcSin method in the MathTrig\Sin class instead + * @See MathTrig\Sin::evaluate() + * Use the evaluate method in the MathTrig\Sin class instead * * @param mixed $number Should be numeric * @@ -1416,7 +1416,7 @@ class MathTrig */ public static function builtinSIN($number) { - return MathTrig\Sin::funcSin($number); + return MathTrig\Sin::evaluate($number); } /** @@ -1426,8 +1426,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Sinh::funcSinh() - * Use the funcSinh method in the MathTrig\Sinh class instead + * @See MathTrig\Sinh::evaluate() + * Use the evaluate method in the MathTrig\Sinh class instead * * @param mixed $number Should be numeric * @@ -1435,7 +1435,7 @@ class MathTrig */ public static function builtinSINH($number) { - return MathTrig\Sinh::funcSinh($number); + return MathTrig\Sinh::evaluate($number); } /** @@ -1464,8 +1464,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Tan::funcTan() - * Use the funcTan method in the MathTrig\Tan class instead + * @See MathTrig\Tan::evaluate() + * Use the evaluate method in the MathTrig\Tan class instead * * @param mixed $number Should be numeric * @@ -1473,7 +1473,7 @@ class MathTrig */ public static function builtinTAN($number) { - return MathTrig\Tan::funcTan($number); + return MathTrig\Tan::evaluate($number); } /** @@ -1483,8 +1483,8 @@ class MathTrig * * @Deprecated 1.18.0 * - * @See MathTrig\Tan::funcTan() - * Use the funcTanh method in the MathTrig\Tanh class instead + * @See MathTrig\Tan::evaluate() + * Use the evaluate method in the MathTrig\Tanh class instead * * @param mixed $number Should be numeric * @@ -1492,7 +1492,7 @@ class MathTrig */ public static function builtinTANH($number) { - return MathTrig\Tanh::funcTanh($number); + return MathTrig\Tanh::evaluate($number); } /** diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Acos.php b/src/PhpSpreadsheet/Calculation/MathTrig/Acos.php index 20d645f2..889c7593 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Acos.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Acos.php @@ -15,7 +15,7 @@ class Acos * * @return float|string The arccosine of the number */ - public static function funcAcos($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Acosh.php b/src/PhpSpreadsheet/Calculation/MathTrig/Acosh.php index f77d3a09..34fb97f4 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Acosh.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Acosh.php @@ -13,9 +13,9 @@ class Acosh * * @param float $number Number * - * @return float|string The arccosine of the number + * @return float|string The arccosine of the number, or an error string */ - public static function funcAcosh($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Acot.php b/src/PhpSpreadsheet/Calculation/MathTrig/Acot.php index 1024f9f6..5817407b 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Acot.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Acot.php @@ -15,7 +15,7 @@ class Acot * * @return float|string The arccotangent of the number */ - public static function funcAcot($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Acoth.php b/src/PhpSpreadsheet/Calculation/MathTrig/Acoth.php index 42bdc181..17fe618d 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Acoth.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Acoth.php @@ -15,7 +15,7 @@ class Acoth * * @return float|string The hyperbolic arccotangent of the number */ - public static function funcAcoth($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Asin.php b/src/PhpSpreadsheet/Calculation/MathTrig/Asin.php index e30ab04c..1db25122 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Asin.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Asin.php @@ -15,7 +15,7 @@ class Asin * * @return float|string The arcsine of the number */ - public static function funcAsin($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Asinh.php b/src/PhpSpreadsheet/Calculation/MathTrig/Asinh.php index 35a3ae26..2cc0b5c9 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Asinh.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Asinh.php @@ -15,7 +15,7 @@ class Asinh * * @return float|string The arc hyperbolic sine of the number */ - public static function funcAsinh($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Atan.php b/src/PhpSpreadsheet/Calculation/MathTrig/Atan.php index 3e57f048..1b4cf43d 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Atan.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Atan.php @@ -15,7 +15,7 @@ class Atan * * @return float|string The arctangent of the number */ - public static function funcAtan($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Atan2.php b/src/PhpSpreadsheet/Calculation/MathTrig/Atan2.php index 2ea975a8..b2cf8bf5 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Atan2.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Atan2.php @@ -28,7 +28,7 @@ class Atan2 * * @return float|string the inverse tangent of the specified x- and y-coordinates, or a string containing an error */ - public static function funcAtan2($xCoordinate, $yCoordinate) + public static function evaluate($xCoordinate, $yCoordinate) { try { $xCoordinate = Helpers::validateNumericNullBool($xCoordinate); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Atanh.php b/src/PhpSpreadsheet/Calculation/MathTrig/Atanh.php index a9723f16..83045441 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Atanh.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Atanh.php @@ -15,7 +15,7 @@ class Atanh * * @return float|string The arc hyperbolic tangent of the number */ - public static function funcAtanh($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Base.php b/src/PhpSpreadsheet/Calculation/MathTrig/Base.php index 35522334..6f44a122 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Base.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Base.php @@ -21,7 +21,7 @@ class Base * * @return string the text representation with the given radix (base) */ - public static function funcBase($number, $radix, $minLength = null) + public static function evaluate($number, $radix, $minLength = null) { try { $number = (int) Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php b/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php index 1085158a..8dde1e74 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Ceiling.php @@ -23,7 +23,7 @@ class Ceiling * * @return float|string Rounded Number, or a string containing an error */ - public static function funcCeiling($number, $significance = null) + public static function evaluate($number, $significance = null) { if ($significance === null) { self::floorCheck1Arg(); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/CeilingMath.php b/src/PhpSpreadsheet/Calculation/MathTrig/CeilingMath.php index e41e9d09..7214b3c5 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/CeilingMath.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/CeilingMath.php @@ -20,7 +20,7 @@ class CeilingMath * * @return float|string Rounded Number, or a string containing an error */ - public static function funcCeilingMath($number, $significance = null, $mode = 0) + public static function evaluate($number, $significance = null, $mode = 0) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/CeilingPrecise.php b/src/PhpSpreadsheet/Calculation/MathTrig/CeilingPrecise.php index 1bc4504b..1573af5a 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/CeilingPrecise.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/CeilingPrecise.php @@ -19,7 +19,7 @@ class CeilingPrecise * * @return float|string Rounded Number, or a string containing an error */ - public static function funcCeilingPrecise($number, $significance = 1) + public static function evaluate($number, $significance = 1) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php b/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php index 78b18fc6..7e7b26ee 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Combinations.php @@ -31,7 +31,7 @@ class Combinations return $e->getMessage(); } - return round(Fact::funcFact($numObjs) / Fact::funcFact($numObjs - $numInSet)) / Fact::funcFact($numInSet); + return round(Fact::evaluate($numObjs) / Fact::evaluate($numObjs - $numInSet)) / Fact::evaluate($numInSet); } /** @@ -69,6 +69,6 @@ class Combinations return $e->getMessage(); } - return round(Fact::funcFact($numObjs + $numInSet - 1) / Fact::funcFact($numObjs - 1)) / Fact::funcFact($numInSet); + return round(Fact::evaluate($numObjs + $numInSet - 1) / Fact::evaluate($numObjs - 1)) / Fact::evaluate($numInSet); } } diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Cos.php b/src/PhpSpreadsheet/Calculation/MathTrig/Cos.php index 2dfed782..798cc5da 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Cos.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Cos.php @@ -15,7 +15,7 @@ class Cos * * @return float|string cosine */ - public static function funcCos($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Cosh.php b/src/PhpSpreadsheet/Calculation/MathTrig/Cosh.php index 3e806cd6..d17bd676 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Cosh.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Cosh.php @@ -15,7 +15,7 @@ class Cosh * * @return float|string cosine */ - public static function funcCosh($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Cot.php b/src/PhpSpreadsheet/Calculation/MathTrig/Cot.php index 1cf5c6b4..53973444 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Cot.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Cot.php @@ -15,7 +15,7 @@ class Cot * * @return float|string The cotangent of the angle */ - public static function funcCot($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Coth.php b/src/PhpSpreadsheet/Calculation/MathTrig/Coth.php index c80ec93e..41e08f85 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Coth.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Coth.php @@ -15,7 +15,7 @@ class Coth * * @return float|string The hyperbolic cotangent of the angle */ - public static function funcCoth($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Csc.php b/src/PhpSpreadsheet/Calculation/MathTrig/Csc.php index 325637b8..125963ef 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Csc.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Csc.php @@ -15,7 +15,7 @@ class Csc * * @return float|string The cosecant of the angle */ - public static function funcCsc($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Csch.php b/src/PhpSpreadsheet/Calculation/MathTrig/Csch.php index 8a045203..b1543ec3 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Csch.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Csch.php @@ -15,7 +15,7 @@ class Csch * * @return float|string The hyperbolic cosecant of the angle */ - public static function funcCsch($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Even.php b/src/PhpSpreadsheet/Calculation/MathTrig/Even.php index ac79a211..59951f31 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Even.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Even.php @@ -22,7 +22,7 @@ class Even * * @return float|string Rounded Number, or a string containing an error */ - public static function funcEven($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php b/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php index 298ccbac..2aa3d349 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Fact.php @@ -21,7 +21,7 @@ class Fact * * @return float|int|string Factorial, or a string containing an error */ - public static function funcFact($factVal) + public static function evaluate($factVal) { try { $factVal = Helpers::validateNumericNullBool($factVal); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php b/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php index f178b324..b3db0adf 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Floor.php @@ -23,12 +23,12 @@ class Floor * Excel Function: * FLOOR(number[,significance]) * - * @param float $number Number to round - * @param float $significance Significance + * @param mixed $number Expect float. Number to round + * @param mixed $significance Expect float. Significance * * @return float|string Rounded Number, or a string containing an error */ - public static function funcFloor($number, $significance = null) + public static function evaluate($number, $significance = null) { if ($significance === null) { self::floorCheck1Arg(); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/FloorMath.php b/src/PhpSpreadsheet/Calculation/MathTrig/FloorMath.php index 8b922829..75a99cb2 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/FloorMath.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/FloorMath.php @@ -21,7 +21,7 @@ class FloorMath * * @return float|string Rounded Number, or a string containing an error */ - public static function funcFloorMath($number, $significance = null, $mode = 0) + public static function evaluate($number, $significance = null, $mode = 0) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/FloorPrecise.php b/src/PhpSpreadsheet/Calculation/MathTrig/FloorPrecise.php index 3ce34dc4..1c719d39 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/FloorPrecise.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/FloorPrecise.php @@ -20,7 +20,7 @@ class FloorPrecise * * @return float|string Rounded Number, or a string containing an error */ - public static function funcFloorPrecise($number, $significance = 1) + public static function evaluate($number, $significance = 1) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php b/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php index e43fe65c..c8f35e48 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/IntClass.php @@ -18,7 +18,7 @@ class IntClass * * @return int|string Integer value, or a string containing an error */ - public static function funcInt($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php b/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php index 38d9b620..5c28684f 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Lcm.php @@ -48,7 +48,7 @@ class Lcm * * @return int|string Lowest Common Multiplier, or a string containing an error */ - public static function funcLcm(...$args) + public static function evaluate(...$args) { try { $arrayArgs = []; diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php b/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php index f0eea049..290700c6 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/MatrixFunctions.php @@ -120,7 +120,7 @@ class MatrixFunctions * * @return array|string The result, or a string containing an error */ - public static function funcMUnit($dimension) + public static function identity($dimension) { try { $dimension = (int) Helpers::validateNumericNullBool($dimension); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Mround.php b/src/PhpSpreadsheet/Calculation/MathTrig/Mround.php index d1b32aa7..5f3c4c05 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Mround.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Mround.php @@ -12,12 +12,12 @@ class Mround * * Rounds a number to the nearest multiple of a specified value * - * @param float $number Number to round - * @param int $multiple Multiple to which you want to round $number + * @param mixed $number Expect float. Number to round. + * @param mixed $multiple Expect int. Multiple to which you want to round. * * @return float|string Rounded Number, or a string containing an error */ - public static function funcMround($number, $multiple) + public static function evaluate($number, $multiple) { try { $number = Helpers::validateNumericNullSubstitution($number, 0); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Multinomial.php b/src/PhpSpreadsheet/Calculation/MathTrig/Multinomial.php index 5ebecb97..98b7d522 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Multinomial.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Multinomial.php @@ -16,7 +16,7 @@ class Multinomial * * @return float|string The result, or a string containing an error */ - public static function funcMultinomial(...$args) + public static function evaluate(...$args) { $summer = 0; $divisor = 1; @@ -28,13 +28,13 @@ class Multinomial Helpers::validateNotNegative($arg); $arg = (int) $arg; $summer += $arg; - $divisor *= Fact::funcFact($arg); + $divisor *= Fact::evaluate($arg); } } catch (Exception $e) { return $e->getMessage(); } - $summer = Fact::funcFact($summer); + $summer = Fact::evaluate($summer); return $summer / $divisor; } diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Odd.php b/src/PhpSpreadsheet/Calculation/MathTrig/Odd.php index b8ef3dd0..c50d2a76 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Odd.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Odd.php @@ -15,7 +15,7 @@ class Odd * * @return float|string Rounded Number, or a string containing an error */ - public static function funcOdd($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Product.php b/src/PhpSpreadsheet/Calculation/MathTrig/Product.php index 254b7b79..79c3f192 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Product.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Product.php @@ -18,7 +18,7 @@ class Product * * @return float|string */ - public static function funcProduct(...$args) + public static function evaluate(...$args) { // Return value $returnValue = null; diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Quotient.php b/src/PhpSpreadsheet/Calculation/MathTrig/Quotient.php index 5f28a3c1..774b5fa1 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Quotient.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Quotient.php @@ -20,7 +20,7 @@ class Quotient * * @return int|string */ - public static function funcQuotient($numerator, $denominator) + public static function evaluate($numerator, $denominator) { try { $numerator = Helpers::validateNumericNullSubstitution($numerator, 0); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php b/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php index 05ecb531..0ee7a919 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Roman.php @@ -822,7 +822,7 @@ class Roman * * @return string Roman numeral, or a string containing an error */ - public static function funcRoman($aValue, $style = 0) + public static function evaluate($aValue, $style = 0) { try { $aValue = Helpers::validateNumericNullBool($aValue); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Round.php b/src/PhpSpreadsheet/Calculation/MathTrig/Round.php index bc1c6669..a6552321 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Round.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Round.php @@ -16,7 +16,7 @@ class Round * * @return float|string Rounded number */ - public static function builtinROUND($number, $precision) + public static function evaluate($number, $precision) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/RoundDown.php b/src/PhpSpreadsheet/Calculation/MathTrig/RoundDown.php index bf19d5d5..e843a6f9 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/RoundDown.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/RoundDown.php @@ -16,7 +16,7 @@ class RoundDown * * @return float|string Rounded Number, or a string containing an error */ - public static function funcRoundDown($number, $digits) + public static function evaluate($number, $digits) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/RoundUp.php b/src/PhpSpreadsheet/Calculation/MathTrig/RoundUp.php index a4f00cd3..c6704ad2 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/RoundUp.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/RoundUp.php @@ -16,7 +16,7 @@ class RoundUp * * @return float|string Rounded Number, or a string containing an error */ - public static function funcRoundUp($number, $digits) + public static function evaluate($number, $digits) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Sec.php b/src/PhpSpreadsheet/Calculation/MathTrig/Sec.php index 9bb5a1b7..d20b6375 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Sec.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Sec.php @@ -15,7 +15,7 @@ class Sec * * @return float|string The secant of the angle */ - public static function funcSec($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Sech.php b/src/PhpSpreadsheet/Calculation/MathTrig/Sech.php index 191bea4d..6bb0469f 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Sech.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Sech.php @@ -15,7 +15,7 @@ class Sech * * @return float|string The hyperbolic secant of the angle */ - public static function funcSech($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php b/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php index 063593b6..73238214 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/SeriesSum.php @@ -19,7 +19,7 @@ class SeriesSum * * @return float|string The result, or a string containing an error */ - public static function funcSeriesSum($x, $n, $m, ...$args) + public static function evaluate($x, $n, $m, ...$args) { try { $x = Helpers::validateNumericNullSubstitution($x, 0); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php b/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php index 84ff523f..1b955a80 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Sign.php @@ -16,7 +16,7 @@ class Sign * * @return int|string sign value, or a string containing an error */ - public static function funcSign($number) + public static function evaluate($number) { try { $number = Helpers::validateNumericNullBool($number); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Sin.php b/src/PhpSpreadsheet/Calculation/MathTrig/Sin.php index f718451c..9ca4acb0 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Sin.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Sin.php @@ -15,7 +15,7 @@ class Sin * * @return float|string Rounded number */ - public static function funcSin($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Sinh.php b/src/PhpSpreadsheet/Calculation/MathTrig/Sinh.php index ce3ef3e5..933b7d6d 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Sinh.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Sinh.php @@ -15,7 +15,7 @@ class Sinh * * @return float|string Rounded number */ - public static function funcSinh($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php b/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php index 3d441fa2..5477d936 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Subtotal.php @@ -48,7 +48,7 @@ class Subtotal [Statistical\Counts::class, 'COUNTA'], // 3 [Statistical\Maximum::class, 'MAX'], // 4 [Statistical\Minimum::class, 'MIN'], // 5 - [Product::class, 'funcProduct'], // 6 + [Product::class, 'evaluate'], // 6 [Statistical\StandardDeviations::class, 'STDEV'], // 7 [Statistical\StandardDeviations::class, 'STDEVP'], // 8 [Sum::class, 'funcSum'], // 9 @@ -72,7 +72,7 @@ class Subtotal * * @return float|string */ - public static function funcSubtotal($functionType, ...$args) + public static function evaluate($functionType, ...$args) { $cellReference = array_pop($args); $aArgs = Functions::flattenArrayIndexed($args); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/SumProduct.php b/src/PhpSpreadsheet/Calculation/MathTrig/SumProduct.php index 1b05cada..7700d008 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/SumProduct.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/SumProduct.php @@ -16,7 +16,7 @@ class SumProduct * * @return float|string The result, or a string containing an error */ - public static function funcSumProduct(...$args) + public static function evaluate(...$args) { $arrayList = $args; diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Tan.php b/src/PhpSpreadsheet/Calculation/MathTrig/Tan.php index 82612cb8..2b1a0ac0 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Tan.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Tan.php @@ -15,7 +15,7 @@ class Tan * * @return float|string Rounded number */ - public static function funcTan($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Tanh.php b/src/PhpSpreadsheet/Calculation/MathTrig/Tanh.php index 29bf82e1..f07f8748 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Tanh.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Tanh.php @@ -15,7 +15,7 @@ class Tanh * * @return float|string Rounded number */ - public static function funcTanh($angle) + public static function evaluate($angle) { try { $angle = Helpers::validateNumericNullBool($angle); diff --git a/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php b/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php index ba82a000..57c389e6 100644 --- a/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php +++ b/src/PhpSpreadsheet/Calculation/MathTrig/Trunc.php @@ -16,7 +16,7 @@ class Trunc * * @return float|string Truncated value, or a string containing an error */ - public static function funcTrunc($value = 0, $digits = 0) + public static function evaluate($value = 0, $digits = 0) { try { $value = Helpers::validateNumericNullBool($value); diff --git a/src/PhpSpreadsheet/Calculation/Statistical.php b/src/PhpSpreadsheet/Calculation/Statistical.php index a0f4cd7c..0f5355b9 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical.php +++ b/src/PhpSpreadsheet/Calculation/Statistical.php @@ -703,7 +703,7 @@ class Statistical { $aArgs = Functions::flattenArray($args); - $aMean = MathTrig\Product::funcProduct($aArgs); + $aMean = MathTrig\Product::evaluate($aArgs); if (is_numeric($aMean) && ($aMean > 0)) { $aCount = Counts::COUNT($aArgs); if (Minimum::MIN($aArgs) > 0) { diff --git a/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php b/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php index c25194a7..3456efcc 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php +++ b/src/PhpSpreadsheet/Calculation/Statistical/Distributions/Poisson.php @@ -42,12 +42,12 @@ class Poisson $summer = 0; $floor = floor($value); for ($i = 0; $i <= $floor; ++$i) { - $summer += $mean ** $i / MathTrig\Fact::funcFact($i); + $summer += $mean ** $i / MathTrig\Fact::evaluate($i); } return exp(0 - $mean) * $summer; } - return (exp(0 - $mean) * $mean ** $value) / MathTrig\Fact::funcFact($value); + return (exp(0 - $mean) * $mean ** $value) / MathTrig\Fact::evaluate($value); } } diff --git a/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php b/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php index 6330d39f..ab2e14dd 100644 --- a/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php +++ b/src/PhpSpreadsheet/Calculation/Statistical/Permutations.php @@ -38,7 +38,7 @@ class Permutations return Functions::NAN(); } - return (int) round(MathTrig\Fact::funcFact($numObjs) / MathTrig\Fact::funcFact($numObjs - $numInSet)); + return (int) round(MathTrig\Fact::evaluate($numObjs) / MathTrig\Fact::evaluate($numObjs - $numInSet)); } /** diff --git a/src/PhpSpreadsheet/Calculation/TextData/Format.php b/src/PhpSpreadsheet/Calculation/TextData/Format.php index 5c76454f..7b0e6efa 100644 --- a/src/PhpSpreadsheet/Calculation/TextData/Format.php +++ b/src/PhpSpreadsheet/Calculation/TextData/Format.php @@ -42,7 +42,7 @@ class Format if ($value < 0) { $round = 0 - $round; } - $value = MathTrig\Mround::funcMround($value, $round); + $value = MathTrig\Mround::evaluate($value, $round); } $mask = "$mask;($mask)"; @@ -66,6 +66,8 @@ class Format if (!is_numeric($value) || !is_numeric($decimals)) { return Functions::VALUE(); } + $decimals = (float) $decimals; + $value = (float) $value; $decimals = (int) floor($decimals); $valueResult = round($value, $decimals); diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MUnitTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MUnitTest.php index 1035dac7..96ebc45b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MUnitTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/MUnitTest.php @@ -8,7 +8,7 @@ class MUnitTest extends AllSetupTeardown { public function testMUNIT(): void { - $identity = MatrixFunctions::funcMUnit(3); + $identity = MatrixFunctions::identity(3); self::assertEquals([[1, 0, 0], [0, 1, 0], [0, 0, 1]], $identity); $startArray = [[1, 2, 2], [4, 5, 6], [7, 8, 9]]; $resultArray = MatrixFunctions::multiply($startArray, $identity); @@ -16,8 +16,8 @@ class MUnitTest extends AllSetupTeardown $inverseArray = MatrixFunctions::inverse($startArray); $resultArray = MatrixFunctions::multiply($startArray, $inverseArray); self::assertEquals($identity, $resultArray); - self::assertEquals('#VALUE!', MatrixFunctions::funcMUnit(0)); - self::assertEquals('#VALUE!', MatrixFunctions::funcMUnit(-1)); - self::assertEquals('#VALUE!', MatrixFunctions::funcMUnit('X')); + self::assertEquals('#VALUE!', MatrixFunctions::identity(0)); + self::assertEquals('#VALUE!', MatrixFunctions::identity(-1)); + self::assertEquals('#VALUE!', MatrixFunctions::identity('X')); } }