aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes/Token/TokenDivision.php
diff options
context:
space:
mode:
authorBruce Wells <phpfui@users.noreply.github.com>2018-10-31 16:51:19 +0300
committerGitHub <noreply@github.com>2018-10-31 16:51:19 +0300
commit07d02e1fb0aeb9fca7174a065f61a5fa2643b12f (patch)
tree86f215d0c7187843e863e7a980ae81943e7d4a5f /src/NXP/Classes/Token/TokenDivision.php
parent43f0ff3f28d198fbb4e36346fc5f36fa91cf3e18 (diff)
parentf0d4562b9ef3bbc64cb8353f0597e639420ede6b (diff)
Merge branch 'master' into master
Diffstat (limited to 'src/NXP/Classes/Token/TokenDivision.php')
-rw-r--r--src/NXP/Classes/Token/TokenDivision.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/NXP/Classes/Token/TokenDivision.php b/src/NXP/Classes/Token/TokenDivision.php
index 5bbc35e..9166d34 100644
--- a/src/NXP/Classes/Token/TokenDivision.php
+++ b/src/NXP/Classes/Token/TokenDivision.php
@@ -59,6 +59,10 @@ class TokenDivision extends AbstractOperator
throw new IncorrectExpressionException("Division requires two operators");
}
+ if ($this->getDivisionByZeroException() && $op2->getValue() == 0) {
+ throw new DivisionByZeroException();
+ }
+
$result = $op2->getValue() != 0 ? $op1->getValue() / $op2->getValue() : 0;
return new TokenNumber($result);