Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793083
LastPayloadSaver.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
LastPayloadSaver.php
View Options
<?php
namespace
Nasqueron\Notifications\Listeners
;
use
Nasqueron\Notifications\Events\Event
;
class
LastPayloadSaver
{
///
/// Events handling
///
/**
* Handles payload events
*/
public
function
onPayload
(
Event
$event
)
{
self
::
savePayload
(
$event
->
payload
);
}
/**
* Saves payload to log file
*
* @param string $payload The payload to save
*/
public
static
function
savePayload
(
$payload
)
{
$filename
=
storage_path
(
'logs/payload.json'
);
$content
=
json_encode
(
$payload
);
file_put_contents
(
$filename
,
$content
);
}
///
/// Events listening
///
/**
* Register the listeners for the subscriber.
*
* @param Illuminate\Events\Dispatcher $events
*/
public
function
subscribe
(
\Illuminate\Events\Dispatcher
$events
)
{
$ns
=
'Nasqueron
\N
otifications
\E
vents'
;
$class
=
'Nasqueron
\N
otifications
\L
isteners
\L
astPayloadSaver'
;
$eventsToListen
=
[
'DockerHubPayloadEvent'
,
'GitHubPayloadEvent'
,
'JenkinsPayloadEvent'
,
'PhabricatorPayloadEvent'
,
];
foreach
(
$eventsToListen
as
$event
)
{
$events
->
listen
(
"$ns
\\
$event"
,
"$class@onPayload"
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 28, 21:39 (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2435925
Default Alt Text
LastPayloadSaver.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment