@@ 47-59 (lines=13) @@ | ||
44 | $errors = $this->validator->validate($subject, null, 'calculate'); |
|
45 | $response = new \stdClass(); |
|
46 | ||
47 | if (count($errors) > 0) { |
|
48 | $response = $this->generateResponseFromErrors($errors); |
|
49 | } else { |
|
50 | $subject = new CodiceFiscaleSubject($data); |
|
51 | ||
52 | $calculator = new Calculator($subject, array( |
|
53 | 'omocodiaLevel' => $data['omocodiaLevel'], |
|
54 | )); |
|
55 | $codiceFiscale = $calculator->calculate(); |
|
56 | ||
57 | $response->status = true; |
|
58 | $response->codiceFiscale = $codiceFiscale; |
|
59 | } |
|
60 | ||
61 | return new JsonResponse($response); |
|
62 | } |
|
@@ 83-93 (lines=11) @@ | ||
80 | $errors = $this->validator->validate($subject, null, 'calculateAll'); |
|
81 | $response = new \stdClass(); |
|
82 | ||
83 | if (count($errors) > 0) { |
|
84 | $response = $this->generateResponseFromErrors($errors); |
|
85 | } else { |
|
86 | $subject = new CodiceFiscaleSubject($data); |
|
87 | ||
88 | $calculator = new Calculator($subject); |
|
89 | $codiciFiscali = $calculator->calculateAllPossibilities(); |
|
90 | ||
91 | $response->status = true; |
|
92 | $response->codiciFiscali = $codiciFiscali; |
|
93 | } |
|
94 | ||
95 | return new JsonResponse($response); |
|
96 | } |