1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-23 09:02:41 +00:00
Arsse/lib/REST/NextCloudNews/Versions.php
J. King 536fa5c4fd Implement NextCloud News version detection
- Improves #47
- Still needs wrapping to actually output to clients
2017-03-19 21:50:00 -04:00

25 lines
No EOL
644 B
PHP

<?php
declare(strict_types=1);
namespace JKingWeb\NewsSync\REST\NextCloudNews;
use JKingWeb\NewsSync\REST\Response;
class Versions implements \JKingWeb\NewsSync\REST\Handler {
function __construct(\JKingWeb\NewsSync\RuntimeData $data) {
}
function dispatch(\JKingWeb\NewsSync\REST\Request $req): \JKingWeb\NewsSync\REST\Response {
$path = $req->url;
$query = "";
if(strpos($path, "?") !== false) {
list($path, $query) = explode("?", $path);
}
if($req->method != "GET") {
return new Response(405);
}
if(preg_match("<^/?$>",$path)) {
return new Response(200, ['v1-2']);
} else {
return new Response(404);
}
}
}