aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/NXP/Classes/Calculator.php4
-rw-r--r--src/NXP/MathExecutor.php2
2 files changed, 2 insertions, 4 deletions
diff --git a/src/NXP/Classes/Calculator.php b/src/NXP/Classes/Calculator.php
index 49142df..4785a8f 100644
--- a/src/NXP/Classes/Calculator.php
+++ b/src/NXP/Classes/Calculator.php
@@ -64,9 +64,7 @@ class Calculator
$value = $variables[$variable];
} elseif ($onVarNotFound) {
$value = call_user_func($onVarNotFound, $variable);
- }
-
- if (!isset($value)) {
+ } else {
throw new UnknownVariableException($variable);
}
diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php
index 434246a..f45335c 100644
--- a/src/NXP/MathExecutor.php
+++ b/src/NXP/MathExecutor.php
@@ -416,7 +416,7 @@ class MathExecutor
*/
public function getVar(string $variable)
{
- if (!isset($this->variables[$variable])) {
+ if (!array_key_exists($variable, $this->variables)) {
throw new UnknownVariableException("Variable ({$variable}) not set");
}
return $this->variables[$variable];