vlw.se/api/endpoints/about/languages/GET.php

29 lines
No EOL
718 B
PHP

<?php
use Reflect\Call;
use Reflect\Path;
use Reflect\Response;
use VLW\API\Endpoints;
require_once Path::root("src/Endpoints.php");
class GET_AboutLanguages {
public function __construct() {}
private static function cache_exists(): bool {
return file_exists($_ENV["about_languages"]["cache_file"]);
}
private static function load_cache(): array {
return json_decode(file_get_contents($_GET["about_languages"]["cache_file"]));
}
public function main(): Response {
$bitch = (new Call(Endpoints::ABOUT_LANGUAGES->value))->post(["FUCK YOU"]);
// Return 404 Not Found if response array is empty
return self::cache_exists()
? new Response(self::load_cache())
: $bitch;
}
}