aboutsummaryrefslogtreecommitdiff
path: root/src/NXP
diff options
context:
space:
mode:
authorBruce Wells <bruce.wells@simparel.com>2019-11-27 19:39:51 +0300
committerBruce Wells <bruce.wells@simparel.com>2019-11-27 20:33:50 +0300
commit84f3f967b71fc39bf61be13e46c89158ad0a34a9 (patch)
tree2b01f4b6c9a695da3246eebc4828372abd659d06 /src/NXP
parent44a13487b5a89951d244ab7a5e723cf7ec893a54 (diff)
Update README.md and more function support
Diffstat (limited to 'src/NXP')
-rw-r--r--src/NXP/Classes/Token/TokenNotEqual.php (renamed from src/NXP/Classes/Token/TokenUnequal.php)2
-rw-r--r--src/NXP/MathExecutor.php123
2 files changed, 109 insertions, 16 deletions
diff --git a/src/NXP/Classes/Token/TokenUnequal.php b/src/NXP/Classes/Token/TokenNotEqual.php
index c8c5d1a..21c9454 100644
--- a/src/NXP/Classes/Token/TokenUnequal.php
+++ b/src/NXP/Classes/Token/TokenNotEqual.php
@@ -4,7 +4,7 @@ namespace NXP\Classes\Token;
use NXP\Exception\IncorrectExpressionException;
-class TokenUnequal extends AbstractOperator
+class TokenNotEqual extends AbstractOperator
{
/**
* @return string
diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php
index 2a5f9fb..5de7dc5 100644
--- a/src/NXP/MathExecutor.php
+++ b/src/NXP/MathExecutor.php
@@ -267,7 +267,7 @@ class MathExecutor
'NXP\Classes\Token\TokenAnd',
'NXP\Classes\Token\TokenOr',
'NXP\Classes\Token\TokenEqual',
- 'NXP\Classes\Token\TokenUnequal',
+ 'NXP\Classes\Token\TokenNotEqual',
'NXP\Classes\Token\TokenGreaterThanOrEqual',
'NXP\Classes\Token\TokenGreaterThan',
'NXP\Classes\Token\TokenLessThanOrEqual',
@@ -278,33 +278,75 @@ class MathExecutor
protected function defaultFunctions()
{
return [
- 'sin' => function ($arg) {
- return sin($arg);
+ 'abs' => function ($arg) {
+ return abs($arg);
},
- 'cos' => function ($arg) {
- return cos($arg);
+ 'acos' => function ($arg) {
+ return acos($arg);
},
- 'tn' => function ($arg) {
- return tan($arg);
+ 'acosh' => function ($arg) {
+ return acosh($arg);
},
'asin' => function ($arg) {
return asin($arg);
},
- 'acos' => function ($arg) {
- return acos($arg);
- },
- 'atn' => function ($arg) {
+ 'atan' => function ($arg) {
return atan($arg);
},
- 'min' => function ($arg1, $arg2) {
- return min($arg1, $arg2);
+ 'atan2' => function ($arg1, $arg2) {
+ return atan2($arg1, $arg2);
},
- 'max' => function ($arg1, $arg2) {
- return max($arg1, $arg2);
+ 'atanh' => function ($arg) {
+ return atanh($arg);
+ },
+ 'atn' => function ($arg) {
+ return atan($arg);
},
'avg' => function ($arg1, $arg2) {
return ($arg1 + $arg2) / 2;
},
+ 'bindec' => function ($arg) {
+ return bindec($arg);
+ },
+ 'ceil' => function ($arg) {
+ return ceil($arg);
+ },
+ 'cos' => function ($arg) {
+ return cos($arg);
+ },
+ 'cosh' => function ($arg) {
+ return cosh($arg);
+ },
+ 'decbin' => function ($arg) {
+ return decbin($arg);
+ },
+ 'dechex' => function ($arg) {
+ return dechex($arg);
+ },
+ 'decoct' => function ($arg) {
+ return decoct($arg);
+ },
+ 'deg2rad' => function ($arg) {
+ return deg2rad($arg);
+ },
+ 'exp' => function ($arg) {
+ return exp($arg);
+ },
+ 'expm1' => function ($arg) {
+ return expm1($arg);
+ },
+ 'floor' => function ($arg) {
+ return floor($arg);
+ },
+ 'fmod' => function ($arg1, $arg2) {
+ return fmod($arg1, $arg2);
+ },
+ 'hexdec' => function ($arg) {
+ return hexdec($arg);
+ },
+ 'hypot' => function ($arg1, $arg2) {
+ return hypot($arg1, $arg2);
+ },
'if' => function ($expr, $trueval, $falseval) {
if ($expr === true || $expr === false) {
$exres = $expr;
@@ -316,6 +358,57 @@ class MathExecutor
} else {
return $this->execute($falseval);
}
+ },
+ 'intdiv' => function ($arg1, $arg2) {
+ return intdiv($arg1, $arg2);
+ },
+ 'log' => function ($arg) {
+ return log($arg);
+ },
+ 'log10' => function ($arg) {
+ return log10($arg);
+ },
+ 'log1p' => function ($arg) {
+ return log1p($arg);
+ },
+ 'max' => function ($arg1, $arg2) {
+ return max($arg1, $arg2);
+ },
+ 'min' => function ($arg1, $arg2) {
+ return min($arg1, $arg2);
+ },
+ 'octdec' => function ($arg) {
+ return octdec($arg);
+ },
+ 'pi' => function () {
+ return pi();
+ },
+ 'pow' => function ($arg1, $arg2) {
+ return pow($arg1, $arg2);
+ },
+ 'rad2deg' => function ($arg) {
+ return rad2deg($arg);
+ },
+ 'round' => function ($arg) {
+ return round($arg);
+ },
+ 'sin' => function ($arg) {
+ return sin($arg);
+ },
+ 'sinh' => function ($arg) {
+ return sinh($arg);
+ },
+ 'sqrt' => function ($arg) {
+ return sqrt($arg);
+ },
+ 'tan' => function ($arg) {
+ return tan($arg);
+ },
+ 'tanh' => function ($arg) {
+ return tanh($arg);
+ },
+ 'tn' => function ($arg) {
+ return tan($arg);
}
];
}