/** * Test Database Connection * * @param array $params * @throws GenericException */ public function test_database($params) { try { if (Request::is_ajax()) { $body = json_decode(Request::get_request_body()); $database = new Database($body->type, $body->host, $body->name, $body->user, $body->pass, $body->char); } else { throw new GenericException('Invalid Request', 400); } } catch (DatabaseException $e) { $protocol = isset(Request::server()['SERVER_PROTOCOL']) ? Request::server()['SERVER_PROTOCOL'] : 'HTTP/1.0'; header($protocol . ' 404 Not Found'); } }