diff options
author | Bruce Wells <brucekwells@gmail.com> | 2020-05-20 05:59:10 +0300 |
---|---|---|
committer | Bruce Wells <brucekwells@gmail.com> | 2020-05-20 05:59:30 +0300 |
commit | a621ea01c02109d2fd5808fe4e471b0dc86a5185 (patch) | |
tree | 41663417ec53d4ebc4eb7559ffe63c533d749fdc | |
parent | 7343f2c9c4b8b7e72bfec22bce6c3df1b85624ab (diff) |
Adding setVars back in
-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 |