diff options
author | Alexander Kiryukhin <alexander@kiryukhin.su> | 2019-01-11 03:27:45 +0300 |
---|---|---|
committer | Bruce Wells <brucekwells@gmail.com> | 2019-01-11 03:27:45 +0300 |
commit | 76517641f79e8f0e4e5f3b620c731bf5c095df17 (patch) | |
tree | c0b03f4fa8acc12058924cbebb1511b31b6a41d8 /src/NXP/MathExecutor.php | |
parent | bf6204aea73441f222d5b9ebb828f9da9d6894ad (diff) |
Fix single quotes parsing (#41)
* Fix single quotes parsing
Fix e-mails
Some small fixes
* Mistake in test
* More PHP versions
Diffstat (limited to 'src/NXP/MathExecutor.php')
-rw-r--r-- | src/NXP/MathExecutor.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php index 706f8af..d123c09 100644 --- a/src/NXP/MathExecutor.php +++ b/src/NXP/MathExecutor.php @@ -13,7 +13,6 @@ namespace NXP; use NXP\Classes\Calculator; use NXP\Classes\Lexer; -use NXP\Classes\Token; use NXP\Classes\TokenFactory; use NXP\Exception\UnknownVariableException; @@ -66,13 +65,13 @@ class MathExecutor /** * Get a specific var * - * @param string $variable + * @param string $variable * @return integer|float * @throws UnknownVariableException */ public function getVar($variable) { - if (! isset($this->variables[$variable])) { + if (!isset($this->variables[$variable])) { throw new UnknownVariableException("Variable ({$variable}) not set"); } @@ -82,9 +81,10 @@ class MathExecutor /** * Add variable to executor * - * @param string $variable + * @param string $variable * @param integer|float $value * @return MathExecutor + * @throws \Exception */ public function setVar($variable, $value) { @@ -100,9 +100,10 @@ class MathExecutor /** * Add variables to executor * - * @param array $variables - * @param bool $clear Clear previous variables + * @param array $variables + * @param bool $clear Clear previous variables * @return MathExecutor + * @throws \Exception */ public function setVars(array $variables, $clear = true) { @@ -120,7 +121,7 @@ class MathExecutor /** * Remove variable from executor * - * @param string $variable + * @param string $variable * @return MathExecutor */ public function removeVar($variable) @@ -143,8 +144,9 @@ class MathExecutor /** * Add operator to executor * - * @param string $operatorClass Class of operator token + * @param string $operatorClass Class of operator token * @return MathExecutor + * @throws Exception\UnknownOperatorException */ public function addOperator($operatorClass) { @@ -166,10 +168,11 @@ class MathExecutor /** * Add function to executor * - * @param string $name Name of function - * @param callable $function Function - * @param int $places Count of arguments + * @param string $name Name of function + * @param callable $function Function + * @param int $places Count of arguments * @return MathExecutor + * @throws \ReflectionException */ public function addFunction($name, $function = null, $places = 1) { @@ -300,7 +303,7 @@ class MathExecutor { return [ 'pi' => 3.14159265359, - 'e' => 2.71828182846 + 'e' => 2.71828182846 ]; } } |