/** * @param string $stringExpression * @return float * @throws InvalidExpressionException */ public function evaluate($stringExpression) { $infixArray = $this->expressionParser->parse($stringExpression); $rpnExpression = $this->notationTransformer->infixToRpn($infixArray); $result = $this->evaluateRpnExpression($rpnExpression); return $result; }
/** * @expectedException \SimpleCalculator\Exception\InvalidOperator */ public function test_it_throws_InvalidOperator_exception_for_expression_with_unknown_operator() { $this->notationTransformer->infixToRpn(['1', '#', '2', '*', '3']); }