aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/MathExecutor.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/NXP/MathExecutor.php')
-rw-r--r--src/NXP/MathExecutor.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php
index 56cefe5..d62d07a 100644
--- a/src/NXP/MathExecutor.php
+++ b/src/NXP/MathExecutor.php
@@ -117,6 +117,10 @@ class MathExecutor
*/
public function setVar($variable, $value)
{
+ if (!is_numeric($value)) {
+ throw new \Exception("Variable ({$variable}) value must be a number ({$value}) type ({gettype($value)})");
+ }
+
$this->variables[$variable] = $value;
return $this;
@@ -196,7 +200,7 @@ class MathExecutor
* @param int $places Count of arguments
* @return MathExecutor
*/
- public function addFunction($name, callable $function = null, $places = 1)
+ public function addFunction($name, $function = null, $places = 1)
{
$this->tokenFactory->addFunction($name, $function, $places);