@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | 'password' => 123456, |
| 13 | 13 | 'password2' => 123456, |
| 14 | 14 | 'phones' => [ |
| 15 | - '949164770','949164771','949164772' |
|
| 15 | + '949164770', '949164771', '949164772' |
|
| 16 | 16 | ], |
| 17 | 17 | 'birth' => '28/09/1996' |
| 18 | 18 | ]), |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | 'role' => 'login' |
| 21 | 21 | ]; |
| 22 | 22 | |
| 23 | -try{ |
|
| 23 | +try { |
|
| 24 | 24 | |
| 25 | 25 | /* Checks whether the passed data is valid for the selected function */ |
| 26 | 26 | $valid = Validator::execute($data); |
| 27 | 27 | |
| 28 | - if(!$valid){ |
|
| 28 | + if (!$valid) { |
|
| 29 | 29 | $errors = []; |
| 30 | - foreach(Validator::getErrors() as $err => $message){ |
|
| 30 | + foreach (Validator::getErrors() as $err => $message) { |
|
| 31 | 31 | $errors[] = [ |
| 32 | - 'input' => array_keys($message)[0], // Return name input error |
|
| 32 | + 'input' => array_keys($message)[0], // Return name input error |
|
| 33 | 33 | 'message' => $message[array_keys($message)[0]] // Return message error |
| 34 | 34 | ] |
| 35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /* Transforms validation to Json format to be validated on the client if desired */ |
| 39 | 39 | $json = Validator::toJson($data); |
| 40 | 40 | |
| 41 | -}catch(Exception $er){ |
|
| 41 | +}catch (Exception $er) { |
|
| 42 | 42 | |
| 43 | 43 | die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}."); |
| 44 | 44 | |