|
|
@ -46,7 +46,6 @@ class Expression |
|
|
|
* Expression is tokenized, parsed, and solved on creation. |
|
|
|
* |
|
|
|
* @param string $expression |
|
|
|
* @param \App\Engine\IOptions $options |
|
|
|
*/ |
|
|
|
public function __construct(string $expression) |
|
|
|
{ |
|
|
@ -54,7 +53,13 @@ class Expression |
|
|
|
$this->nodes = static::parse($tokens); |
|
|
|
} |
|
|
|
|
|
|
|
public function solve(\App\Engine\IOptions $options) |
|
|
|
/** |
|
|
|
* Solve this expression down to the minimal set of nodes we can |
|
|
|
* |
|
|
|
* @param \App\Engine\IOptions $options |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function solve(\App\Engine\IOptions $options): void |
|
|
|
{ |
|
|
|
$this->nodes = static::_solve($this->nodes, $options->getVariables(), array_keys($options->getParameters())); |
|
|
|
} |
|
|
@ -142,7 +147,7 @@ class Expression |
|
|
|
$variables = []; |
|
|
|
foreach ($this->nodes as $node) |
|
|
|
{ |
|
|
|
$node->walk(function($node) use (&$variables) { |
|
|
|
$node->walk(function(GraphNode $node) use (&$variables): void { |
|
|
|
if ($node->getValue() instanceof Token\Variable) |
|
|
|
{ |
|
|
|
$variables[] = $node->getValue()->getName(); |
|
|
|