1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00
Arsse/lib/REST/Request.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

23 lines
No EOL
733 B
PHP

<?php
declare(strict_types=1);
namespace JKingWeb\NewsSync\REST;
class Request {
public $method = "GET";
public $url = "";
public $type ="";
public $stream = "php://input";
function __construct(string $method = null, string $url = null, string $bodyStream = null, string $contentType = null) {
if(is_null($method)) $method = $_SERVER['REQUEST_METHOD'];
if(is_null($url)) $url = $_SERVER['REQUEST_URI'];
if(is_null($bodyStream)) $bodyStream = "php://input";
if(is_null($contentType)) {
if(isset($_SERVER['HTTP_CONTENT_TYPE'])) $contentType = $_SERVER['HTTP_CONTENT_TYPE'];
}
$this->method = strtoupper($method);
$this->url = $url;
$this->stream = $bodyStream;
$this->type = $contentType;
}
}