public function run($value, $result = 0) { if (isset($this->result)) { $res = $this->result; } else { $res = $result; } $this->result = $this->instance->run($value, $res); return $this; }
/** * @return mixed */ public function start() { // Input echo 'Formel: '; $formula = trim(fgets(STDIN)); // Processing $formulaObj = $this->parser->parse($formula); $result = $this->calculator->calculate($formulaObj); // Output echo 'Ergebnis: '; echo $result; echo "\n"; }