Loading src/Calc/Cell.php +13 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ class Cell public function getFormuleExpr(): ?array { $fText = $this->getFormule(); if (!$fText) $fText = $this->getValue(); if (!$fText) return null; $formule = new Formule($fText); Loading @@ -142,6 +143,18 @@ class Cell public function getDeps(): array { $fText = $this->getFormule(); if (!$fText) return []; $formule = new Formule($fText); return $formule->getDepCells(); } /** * @return mixed */ Loading src/Calc/Formule.php +32 −14 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ class Formule public function analyse(): array { $this->terms = []; if (empty($this->terms)) { $start = 0; if (str_starts_with($this->formule, 'of:=')) { Loading @@ -61,12 +61,30 @@ class Formule $this->lexing(); $this->grammar(); } return $this->expr; } public function getDepCells(): array { $cells = []; $this->analyse(); foreach($this->terms as $term){ if ($term['type'] === 'cell'){ $cells[] = $term['name']; } } return $cells; } public function displayTerms() { echo '<div style="clear: both"><code>' . htmlentities($this->formule) . '</code></div>'; Loading Loading
src/Calc/Cell.php +13 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ class Cell public function getFormuleExpr(): ?array { $fText = $this->getFormule(); if (!$fText) $fText = $this->getValue(); if (!$fText) return null; $formule = new Formule($fText); Loading @@ -142,6 +143,18 @@ class Cell public function getDeps(): array { $fText = $this->getFormule(); if (!$fText) return []; $formule = new Formule($fText); return $formule->getDepCells(); } /** * @return mixed */ Loading
src/Calc/Formule.php +32 −14 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ class Formule public function analyse(): array { $this->terms = []; if (empty($this->terms)) { $start = 0; if (str_starts_with($this->formule, 'of:=')) { Loading @@ -61,12 +61,30 @@ class Formule $this->lexing(); $this->grammar(); } return $this->expr; } public function getDepCells(): array { $cells = []; $this->analyse(); foreach($this->terms as $term){ if ($term['type'] === 'cell'){ $cells[] = $term['name']; } } return $cells; } public function displayTerms() { echo '<div style="clear: both"><code>' . htmlentities($this->formule) . '</code></div>'; Loading