Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12742386
PhabricatorGateController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorGateController.php
View Options
<?php
namespace
Nasqueron\Notifications\Http\Controllers\Gate
;
use
Event
;
use
Log
;
use
Request
;
use
Nasqueron\Notifications\Events\PhabricatorPayloadEvent
;
use
Nasqueron\Notifications\Phabricator\PhabricatorStory
;
//use Nasqueron\Notifications\Events\PhabricatorPayloadEvent;
class
PhabricatorGateController
extends
GateController
{
///
/// Private members
///
/**
* The request content, as a structured data
*
* @var string
*/
private
$payload
;
///
/// Constants
///
const
SERVICE_NAME
=
'Phabricator'
;
///
/// Requests processing
///
/**
* Handles POST requests
*
* @param Request $request the HTTP request
*/
public
function
onPost
(
$door
)
{
$this
->
door
=
$door
;
$this
->
instance
=
$this
->
getInstance
();
if
(
$this
->
instance
===
""
)
{
abort
(
404
,
'Unknown Phabricator instance.'
);
return
;
}
$this
->
extractPayload
();
$this
->
logRequest
();
$this
->
onPayload
();
return
parent
::
renderReport
();
}
/**
* Extracts payload from the request
*/
protected
function
extractPayload
()
{
$this
->
payload
=
Request
::
all
();
}
/**
* Gets the instance matching this door
*
* @return string The Phabricator root URL without trailing slash
*/
protected
function
getInstance
()
{
$service
=
$this
->
getService
();
if
(
$service
===
null
)
{
return
""
;
}
return
$service
->
instance
;
}
/**
* 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
PhabricatorPayloadEvent
(
$this
->
door
,
$this
->
instance
,
$this
->
payload
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 16, 13:45 (14 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3144002
Default Alt Text
PhabricatorGateController.php (2 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment