T201704032327

This commit is contained in:
Leander
2017-04-03 23:28:04 +02:00
parent 7dfdf40d97
commit 008ee7b5d7
3 changed files with 18 additions and 10 deletions

View File

@@ -42,6 +42,9 @@ class Database
static function create_response($data, $error, $values = null) {
$status_message = Database::create_status_code($error, $values);
$meta = array('status'=>$error, 'message'=>$status_message);
if($error == 0){
$data = '';
}
$response_element_json = json_encode(array('meta'=>$meta, 'data'=>$data), JSON_PRETTY_PRINT);
return $response_element_json;
}
@@ -58,11 +61,13 @@ class Database
case 11102:
return 'User name already exists. Please pick a different name.';
case 12101:
return 'A game without a question is not possible. Please select new game length.';
return 'User name not specified. This is an internal error.';
case 12102:
return 'We only have '.$values[0].' questions. Please select new game length.';
return 'A game without a question is not possible. Please select new game length.';
case 12103:
return 'No user ID specified. Sebastian, please fix the app.';
return 'Sorry, we only have '.$values[0].' questions. Please try again.';
case 12104:
return 'The specified user name does not exist.';
default:
return 'An unknown error occurred.';
}