From 18b12aeeff34c8ac9a350165ae36f08f4138dc9c Mon Sep 17 00:00:00 2001 From: Bruce Wells Date: Thu, 10 Jan 2019 20:18:10 -0500 Subject: sync (#5) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Added simple coc (#37) * Added simple coc * Fix * Replaceable operators (#38) * Updated from NeonXP/MathExecutor * Fixed function in () block issue * Fixing typos in and clarifying documentation. * Syncing from origin (#3) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Allow for operators to be replaced based on regex expression * Fix md typo (#39) * Updated from NeonXP/MathExecutor * Fixed function in () block issue * Fixing typos in and clarifying documentation. * Syncing from origin (#3) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Syncing to origin (#4) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Added simple coc (#37) * Added simple coc * Fix * Replaceable operators (#38) * Updated from NeonXP/MathExecutor * Fixed function in () block issue * Fixing typos in and clarifying documentation. * Syncing from origin (#3) * Documentation fixes (#34) Fixing typos in and clarifying documentation. * MathExecutor allow override default operators, functions and vars (#36) * Allow for operators to be replaced based on regex expression * \\ instead of \ * Update README.md Some small fixes * Fix single quotes parsing (#41) * Fix single quotes parsing Fix e-mails Some small fixes * Mistake in test * More PHP versions * Update README.md Deleted `dev` branch --- src/NXP/MathExecutor.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/NXP/MathExecutor.php') diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php index 706f8af..29c6a64 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) { -- cgit v1.2.3