public function testMap()
 {
     $operazione = "mul";
     $riconoscimento = new CalculateMap();
     $result = $riconoscimento->map($operazione);
     $this->assertInstanceOf('\\Application\\Calculator\\MultOperation', $result);
 }
 public function calculateAction()
 {
     $num1 = (double) $this->params()->fromPost('num1');
     $num2 = (double) $this->params()->fromPost('num2');
     $simbolo = $this->params()->fromPost('operazione');
     if (!$simbolo) {
         return new JsonModel(['result' => 0]);
     }
     $calcolo = new Calculator();
     $result = $calcolo->calculate(CalculateMap::map($simbolo), $num1, $num2);
     return new JsonModel(['result' => $result]);
 }