changed PDO to DatabaseConnection
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
614a56a675
commit
c0ac072bb3
|
@ -15,7 +15,7 @@ class RequestController
|
|||
private String $message;
|
||||
|
||||
/**
|
||||
* @param \App\Controller\DatabaseConnection $databaseConnection
|
||||
* @param DatabaseConnection $databaseConnection
|
||||
* @param String $requestMethod
|
||||
* @param array $uri
|
||||
*/
|
||||
|
@ -31,11 +31,14 @@ class RequestController
|
|||
*/
|
||||
public function processRequest()
|
||||
{
|
||||
if (empty($this->uri[2]) || $this->uri[2] != 'domains') {
|
||||
if (empty($this->uri[2]) || !(($this->uri[2] == 'domains') || $this->uri[2] == 'ping')) {
|
||||
$this->status = "404 Not Found";
|
||||
$this->message = "Endpoint not found.";
|
||||
} else {
|
||||
if ($this->checkPassword()) {
|
||||
if ($this->uri[2] == "ping") {
|
||||
$this->status = 'pong';
|
||||
} else {
|
||||
try {
|
||||
match ($this->requestMethod) {
|
||||
'GET' => $this->handleDomainGetRequest(),
|
||||
|
@ -49,9 +52,15 @@ class RequestController
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->result)) {
|
||||
echo json_encode($this->result);
|
||||
} else {
|
||||
if ($this->status == 'pong') {
|
||||
echo json_encode([
|
||||
'response' => $this->status
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
'status' => $this->status ?? "Error: No status",
|
||||
|
@ -59,6 +68,7 @@ class RequestController
|
|||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue