File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88if (!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
1414require_once __DIR__ . '/../database.php ' ;
1515require_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 ' ];
You can’t perform that action at this time.
0 commit comments