Page MenuHomeDevCentral

BaseService.php
No OneTemporary

BaseService.php

<?php
namespace Nasqueron\Api\ServersLog;
use Exception;
class BaseService {
///
/// Helper methods
///
protected function getBodyObject () {
$content= file_get_contents('php://input');
switch ($_SERVER["HTTP_CONTENT_TYPE"]) {
case "application/json":
return json_decode($content);
default:
throw new Exception("Unknown content type.");
}
}
protected function sendSuccessResponse ($responseBody = '') {
// HTTP 200 OK
echo $responseBody;
}
protected function sendInvalidMethodResponse () {
header("HTTP/1.0 405 Method Not Allowed");
http_response_code(405);
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Nov 13, 17:19 (1 d, 23 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4257914
Default Alt Text
BaseService.php (720 B)

Event Timeline