@@ -36,24 +36,24 @@ discard block |
||
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | //Home page |
| 39 | -$app->get('/', function (Silex\Application $app) { |
|
| 39 | +$app->get('/', function(Silex\Application $app) { |
|
| 40 | 40 | return $app['twig']->render('index.twig'); |
| 41 | 41 | }) |
| 42 | 42 | ->bind('homepage'); |
| 43 | 43 | |
| 44 | 44 | //Documentazione |
| 45 | -$app->get('/documentazione', function (Silex\Application $app) { |
|
| 45 | +$app->get('/documentazione', function(Silex\Application $app) { |
|
| 46 | 46 | return $app['twig']->render('documentazione.twig'); |
| 47 | 47 | }) |
| 48 | 48 | ->bind('documentazione'); |
| 49 | 49 | |
| 50 | 50 | //Prova |
| 51 | -$app->get('/prova', function (Silex\Application $app) { |
|
| 51 | +$app->get('/prova', function(Silex\Application $app) { |
|
| 52 | 52 | return $app['twig']->render('prova.twig'); |
| 53 | 53 | }) |
| 54 | 54 | ->bind('prova'); |
| 55 | 55 | |
| 56 | -$app->error(function (\Exception $e, $code) { |
|
| 56 | +$app->error(function(\Exception $e, $code) { |
|
| 57 | 57 | switch ($code) { |
| 58 | 58 | case 404: |
| 59 | 59 | $message = 'The requested page could not be found.'; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $app->mount('/api/codiceFiscale', require 'api.php'); |
| 70 | 70 | |
| 71 | -$app->after(function (Request $request, Response $response) { |
|
| 71 | +$app->after(function(Request $request, Response $response) { |
|
| 72 | 72 | $response->headers->set('Access-Control-Allow-Origin', '*'); |
| 73 | 73 | }); |
| 74 | 74 | |
@@ -152,8 +152,8 @@ |
||
| 152 | 152 | $subject = new Subject($data); |
| 153 | 153 | |
| 154 | 154 | $checker = new Checker($subject, array( |
| 155 | - 'codiceFiscaleToCheck' => $data['codiceFiscale'], |
|
| 156 | - 'omocodiaLevel' => $data['omocodiaLevel'] |
|
| 155 | + 'codiceFiscaleToCheck' => $data['codiceFiscale'], |
|
| 156 | + 'omocodiaLevel' => $data['omocodiaLevel'] |
|
| 157 | 157 | )); |
| 158 | 158 | |
| 159 | 159 | if ($checker->check()) { |
@@ -159,8 +159,7 @@ |
||
| 159 | 159 | if ($checker->check()) { |
| 160 | 160 | $response->status = true; |
| 161 | 161 | $response->message = 'Valid codice fiscale'; |
| 162 | - } |
|
| 163 | - else { |
|
| 162 | + } else { |
|
| 164 | 163 | $response->status = false; |
| 165 | 164 | $response->message = 'Invalid codice fiscale'; |
| 166 | 165 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $api = $app['controllers_factory']; |
| 21 | 21 | |
| 22 | 22 | //Calculate the codice fiscale by the given parameters. |
| 23 | - $api->get('/calculate', function (Application $app, Request $request) { |
|
| 23 | + $api->get('/calculate', function(Application $app, Request $request) { |
|
| 24 | 24 | $constraint = new Assert\Collection(array( |
| 25 | 25 | 'name' => $app['codice-fiscale-rest.constraints']['name'], |
| 26 | 26 | 'surname' => $app['codice-fiscale-rest.constraints']['surname'], |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | //Calculate all the codice fiscale by the given parameters. |
| 64 | - $api->get('/calculateAll', function (Application $app, Request $request) { |
|
| 64 | + $api->get('/calculateAll', function(Application $app, Request $request) { |
|
| 65 | 65 | $constraint = new Assert\Collection(array( |
| 66 | 66 | 'name' => $app['codice-fiscale-rest.constraints']['name'], |
| 67 | 67 | 'surname' => $app['codice-fiscale-rest.constraints']['surname'], |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ->bind('apiCalculateAll'); |
| 99 | 99 | |
| 100 | 100 | //Check if the given parameters are ok for the given parameters. |
| 101 | - $api->get('/check', function (Application $app, Request $request) { |
|
| 101 | + $api->get('/check', function(Application $app, Request $request) { |
|
| 102 | 102 | $constraint = new Assert\Collection(array( |
| 103 | 103 | 'name' => $app['codice-fiscale-rest.constraints']['name'], |
| 104 | 104 | 'surname' => $app['codice-fiscale-rest.constraints']['surname'], |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param $errors The ConstraintViolationList instance. |
| 155 | 155 | * @return Returns the response from the given errors. |
| 156 | 156 | */ |
| 157 | - private function generateResponseFromErrors(\Symfony\Component\Validator\ConstraintViolationList $errors){ |
|
| 157 | + private function generateResponseFromErrors(\Symfony\Component\Validator\ConstraintViolationList $errors) { |
|
| 158 | 158 | $response = new \stdclass; |
| 159 | 159 | $response->status = false; |
| 160 | 160 | $accessor = PropertyAccess::createPropertyAccessor(); |