Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11725036
BaseService.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1009 B
Referenced Files
None
Subscribers
None
BaseService.php
View Options
<?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
sendBadRequestResponse
()
{
header
(
"HTTP/1.0 400 Bad Request"
);
http_response_code
(
400
);
}
protected
function
sendInvalidMethodResponse
()
{
header
(
"HTTP/1.0 405 Method Not Allowed"
);
http_response_code
(
405
);
}
protected
function
sendInternalServerErrorResponse
()
{
header
(
"HTTP/1.0 500 Internal Server Error"
);
http_response_code
(
500
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Sep 18, 19:02 (8 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2991336
Default Alt Text
BaseService.php (1009 B)
Attached To
Mode
rAPISRVLOGS Servers log :: Add new entries API
Attached
Detach File
Event Timeline
Log In to Comment