Skip to content

Commit dbd6944

Browse files
committed
Add php types to logmail endpoint
1 parent f36383d commit dbd6944

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

mailscanner/api/logmail.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@
77

88
if (!defined('API_KEY')) {
99
http_response_code(401); // Unauthorized
10-
echo json_encode(['error' => 'Unauthorized - Set an API KEY to use this API']);
10+
echo json_encode(['error' => 'Unauthorized - Set an API KEY to use this API'], JSON_THROW_ON_ERROR);
1111
exit;
1212
}
1313

1414
require_once __DIR__ . '/../database.php';
1515
require_once __DIR__ . '/MailLogEntry.php';
1616

17-
/**
18-
* @param ?string $apiKey
19-
*
20-
* @return bool
21-
*/
22-
function isValidApiKey($apiKey)
17+
function isValidApiKey(?string $apiKey): bool
2318
{
2419
if (null === $apiKey) {
2520
return false;
@@ -32,10 +27,7 @@ function isValidApiKey($apiKey)
3227
return API_KEY === $apiKey;
3328
}
3429

35-
/**
36-
* @return ?string
37-
*/
38-
function getApiKeyToken()
30+
function getApiKeyToken(): ?string
3931
{
4032
if (isset($_SERVER['HTTP_X_MAILWATCH_API_KEY'])) {
4133
return $_SERVER['HTTP_X_MAILWATCH_API_KEY'];

0 commit comments

Comments
 (0)