diff options
author | Bruce Wells <brucekwells@gmail.com> | 2020-06-03 16:59:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-03 16:59:55 +0300 |
commit | 333a52e9aa64272b0011e108714c93c0f1e0d7db (patch) | |
tree | a1f6985aa44e3af0296989435427d57bc5219add /src/NXP/Classes | |
parent | 913cf0a1e8920dbcc18649fa173a0c7e6ba5d5ef (diff) | |
parent | ea898d7a7b85aeb677f81f13784232c99b61808a (diff) |
Merge pull request #4 from neonxp/master
Latest from master
Diffstat (limited to 'src/NXP/Classes')
-rw-r--r-- | src/NXP/Classes/Calculator.php | 4 | ||||
-rw-r--r-- | src/NXP/Classes/CustomFunction.php | 5 | ||||
-rw-r--r-- | src/NXP/Classes/Operator.php | 3 | ||||
-rw-r--r-- | src/NXP/Classes/Tokenizer.php | 2 |
4 files changed, 5 insertions, 9 deletions
diff --git a/src/NXP/Classes/Calculator.php b/src/NXP/Classes/Calculator.php index c6ccff1..94c6933 100644 --- a/src/NXP/Classes/Calculator.php +++ b/src/NXP/Classes/Calculator.php @@ -56,14 +56,14 @@ class Calculator foreach ($tokens as $token) { if ($token->type === Token::Literal || $token->type === Token::String) { $stack[] = $token; - } else if ($token->type === Token::Variable) { + } elseif ($token->type === Token::Variable) { $variable = $token->value; if (!array_key_exists($variable, $variables)) { throw new UnknownVariableException($variable); } $value = $variables[$variable]; $stack[] = new Token(Token::Literal, $value); - } else if ($token->type === Token::Function) { + } elseif ($token->type === Token::Function) { if (!array_key_exists($token->value, $this->functions)) { throw new UnknownFunctionException($token->value); } diff --git a/src/NXP/Classes/CustomFunction.php b/src/NXP/Classes/CustomFunction.php index bf36405..06e21ef 100644 --- a/src/NXP/Classes/CustomFunction.php +++ b/src/NXP/Classes/CustomFunction.php @@ -3,7 +3,6 @@ namespace NXP\Classes; - use NXP\Exception\IncorrectExpressionException; use ReflectionException; use ReflectionFunction; @@ -58,6 +57,4 @@ class CustomFunction return new Token(Token::Literal, $result); } - - -}
\ No newline at end of file +} diff --git a/src/NXP/Classes/Operator.php b/src/NXP/Classes/Operator.php index c3762ea..86df549 100644 --- a/src/NXP/Classes/Operator.php +++ b/src/NXP/Classes/Operator.php @@ -3,7 +3,6 @@ namespace NXP\Classes; - use NXP\Exception\IncorrectExpressionException; use ReflectionFunction; @@ -66,4 +65,4 @@ class Operator return new Token(Token::Literal, $result); } -}
\ No newline at end of file +} diff --git a/src/NXP/Classes/Tokenizer.php b/src/NXP/Classes/Tokenizer.php index caf395f..6b14677 100644 --- a/src/NXP/Classes/Tokenizer.php +++ b/src/NXP/Classes/Tokenizer.php @@ -106,6 +106,7 @@ class Tokenizer $this->allowNegative = true; break; } + // no break case $this->isAlpha($ch): if ($this->numberBuffer != "") { $this->emptyNumberBufferAsLiteral(); @@ -299,4 +300,3 @@ class Tokenizer return $tokens; } } - |