20 lines
522 B
PHP
Raw Permalink Normal View History

<?PHP
/**
* Provides the API.
*/
declare(strict_types = 1);
require_once __DIR__ . '/../provideEnv.php';
2025-01-22 15:10:59 +01:00
header('Content-Type: application/json; charset=utf-8');
$verb = MD_STD_IN::get_http_input_text("verb");
$subject = MD_STD_IN::get_http_input_text("subject");
2025-01-22 15:10:59 +01:00
$output = match ($verb) {
'evaluate' => (new ConcordanceChecker($subject))->evaluate(explode(PHP_EOL, $_POST['terms'] ?? $_GET['terms'] ?? [])),
default => throw new MDpageParameterNotFromListException(),
};
2025-01-22 15:10:59 +01:00
echo MD_STD::json_encode($output);