Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4792893
DockerHubGateController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
DockerHubGateController.php
View Options
<?php
namespace
Nasqueron\Notifications\Http\Controllers\Gate
;
use
Event
;
use
Log
;
use
Request
;
use
Nasqueron\Notifications\Events\DockerHubPayloadEvent
;
class
DockerHubGateController
extends
GateController
{
///
/// Private members
///
/**
* The request content, as a structured data
*
* @var stdClass
*/
private
$payload
;
/**
* The request content
*
* @var string
*/
private
$rawRequestContent
;
///
/// Constants
///
const
SERVICE_NAME
=
'DockerHub'
;
///
/// Request processing
///
/**
* Handles POST requests
*
* @param Request $request the HTTP request
* @return Illuminate\Http\Response
*/
public
function
onPost
(
$door
)
{
// Parses the request and check if it's legit
$this
->
door
=
$door
;
$this
->
extractPayload
();
// Process the request
$this
->
logRequest
();
$this
->
onPayload
();
// Output
return
parent
::
renderReport
();
}
/**
* Extracts payload from the request
*/
protected
function
extractPayload
()
{
$request
=
Request
::
instance
();
$this
->
rawRequestContent
=
$request
->
getContent
();
$this
->
payload
=
json_decode
(
$this
->
rawRequestContent
);
}
/**
* Logs the request
*/
protected
function
logRequest
()
{
Log
::
info
(
'[Gate] New payload.'
,
[
'service'
=>
static
::
SERVICE_NAME
,
'door'
=>
$this
->
door
]);
}
///
/// Payload processing
///
protected
function
onPayload
()
{
$this
->
initializeReport
();
Event
::
fire
(
new
DockerHubPayloadEvent
(
$this
->
door
,
$this
->
payload
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:39 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2441075
Default Alt Text
DockerHubGateController.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment