| Conditions | 2 |
| Paths | 5 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function calculate(string $operator, string $operandA, string $operandB): void |
||
| 28 | { |
||
| 29 | $operator = trim($operator); |
||
| 30 | $operandA = trim($operandA); |
||
| 31 | $operandB = trim($operandB); |
||
| 32 | try |
||
| 33 | { |
||
| 34 | $result = $this->calculator->calculate($operator, $operandA, $operandB); |
||
| 35 | // Share the result value with the other components. |
||
| 36 | $this->stash()->set('calculator.operator', $operator); |
||
| 37 | $this->stash()->set('calculator.result', $result); |
||
| 38 | // Render the result component. |
||
| 39 | $this->cl(Result::class)->render(); |
||
| 40 | } |
||
| 41 | catch(Exception $e) |
||
| 42 | { |
||
| 43 | $this->alert()->title('Error!!!')->error($e->getMessage()); |
||
| 44 | } |
||
| 47 |