示例#1
0
 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;
 }
示例#2
0
 /**
  * @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";
 }