Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue MathTrig Breakup - Completion! #1985

Merged
merged 11 commits into from
Apr 5, 2021
24 changes: 12 additions & 12 deletions src/PhpSpreadsheet/Calculation/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class Calculation
private static $phpSpreadsheetFunctions = [
'ABS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'builtinABS'],
'functionCall' => [MathTrig\Abs::class, 'evaluate'],
oleibman marked this conversation as resolved.
Show resolved Hide resolved
'argumentCount' => '1',
],
'ACCRINT' => [
Expand Down Expand Up @@ -835,7 +835,7 @@ class Calculation
],
'DEGREES' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'builtinDEGREES'],
'functionCall' => [MathTrig\Degrees::class, 'evaluate'],
'argumentCount' => '1',
],
'DELTA' => [
Expand Down Expand Up @@ -975,7 +975,7 @@ class Calculation
],
'EXP' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'builtinEXP'],
'functionCall' => [MathTrig\Exp::class, 'evaluate'],
'argumentCount' => '1',
],
'EXPONDIST' => [
Expand Down Expand Up @@ -2038,7 +2038,7 @@ class Calculation
],
'RADIANS' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'builtinRADIANS'],
'functionCall' => [MathTrig\Radians::class, 'evaluate'],
'argumentCount' => '1',
],
'RAND' => [
Expand Down Expand Up @@ -2185,7 +2185,7 @@ class Calculation
],
'SERIESSUM' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SERIESSUM'],
'functionCall' => [MathTrig\SeriesSum::class, 'funcSeriesSum'],
oleibman marked this conversation as resolved.
Show resolved Hide resolved
'argumentCount' => '4',
],
'SHEET' => [
Expand All @@ -2205,7 +2205,7 @@ class Calculation
],
'SIN' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'builtinSIN'],
'functionCall' => [MathTrig\Sin::class, 'funcSin'],
oleibman marked this conversation as resolved.
Show resolved Hide resolved
'argumentCount' => '1',
],
'SINH' => [
Expand Down Expand Up @@ -2250,12 +2250,12 @@ class Calculation
],
'SQRT' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'builtinSQRT'],
'functionCall' => [MathTrig\Sqrt::class, 'evaluate'],
'argumentCount' => '1',
],
'SQRTPI' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SQRTPI'],
'functionCall' => [MathTrig\SqrtPi::class, 'evaluate'],
'argumentCount' => '1',
],
'STANDARDIZE' => [
Expand Down Expand Up @@ -2331,22 +2331,22 @@ class Calculation
],
'SUMSQ' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMSQ'],
'functionCall' => [MathTrig\SumSquares::class, 'sumSquare'],
'argumentCount' => '1+',
],
'SUMX2MY2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMX2MY2'],
'functionCall' => [MathTrig\SumSquares::class, 'sumXSquaredMinusYSquared'],
'argumentCount' => '2',
],
'SUMX2PY2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMX2PY2'],
'functionCall' => [MathTrig\SumSquares::class, 'sumXSquaredPlusYSquared'],
'argumentCount' => '2',
],
'SUMXMY2' => [
'category' => Category::CATEGORY_MATH_AND_TRIG,
'functionCall' => [MathTrig::class, 'SUMXMY2'],
'functionCall' => [MathTrig\SumSquares::class, 'sumXMinusYSquared'],
'argumentCount' => '2',
],
'SWITCH' => [
Expand Down
8 changes: 6 additions & 2 deletions src/PhpSpreadsheet/Calculation/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,19 @@ public static function isLeapYear($year)
/**
* getDateValue.
*
* @Deprecated 2.0.0 Use the method getDateValueNoThrow in the DateTimeExcel\Helpers class instead
* @Deprecated 2.0.0 Use the method getDateValue in the DateTimeExcel\Helpers class instead
*
* @param mixed $dateValue
*
* @return mixed Excel date/time serial value, or string if error
*/
public static function getDateValue($dateValue)
{
return DateTimeExcel\Helpers::getDateValueNoThrow($dateValue);
try {
return DateTimeExcel\Helpers::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
}

/**
Expand Down
16 changes: 0 additions & 16 deletions src/PhpSpreadsheet/Calculation/DateTimeExcel/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,6 @@ public static function getDateValue($dateValue, bool $allowBool = true)
return (float) $dateValue;
}

/**
* getDateValueNoThrow.
*
* @param mixed $dateValue
*
* @return mixed Excel date/time serial value, or string if error
*/
public static function getDateValueNoThrow($dateValue)
{
try {
return self::getDateValue($dateValue);
} catch (Exception $e) {
return $e->getMessage();
}
}

/**
* getTimeValue.
*
Expand Down
Loading