diff options
-rw-r--r-- | src/NXP/MathExecutor.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/NXP/MathExecutor.php b/src/NXP/MathExecutor.php index e214209..0c643a7 100644 --- a/src/NXP/MathExecutor.php +++ b/src/NXP/MathExecutor.php @@ -426,6 +426,25 @@ class MathExecutor } /** + * Add variables to executor + * + * @param array $variables + * @param bool $clear Clear previous variables + * @return MathExecutor + * @throws \Exception + */ + public function setVars(array $variables, bool $clear = true) : self + { + if ($clear) { + $this->removeVars(); + } + foreach ($variables as $name => $value) { + $this->setVar($name, $value); + } + return $this; + } + + /** * Remove variable from executor * * @param string $variable |