/** * @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; }
/** * @dataProvider expressionDataProvider */ public function test_it_correctly_parses_expression_string($expression, $expected) { $parsed = $this->expressionParser->parse($expression); $this->assertEquals($expected, $parsed); }