Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F10770420
NotificationListener.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
NotificationListener.php
View Options
<?php
namespace
Nasqueron\Notifications\Listeners
;
use
Nasqueron\Notifications\Events\DockerHubPayloadEvent
;
use
Nasqueron\Notifications\Events\GitHubPayloadEvent
;
use
Nasqueron\Notifications\Events\JenkinsPayloadEvent
;
use
Nasqueron\Notifications\Events\PhabricatorPayloadEvent
;
use
Nasqueron\Notifications\Jobs\FireDockerHubNotification
;
use
Nasqueron\Notifications\Jobs\FireGitHubNotification
;
use
Nasqueron\Notifications\Jobs\FireJenkinsNotification
;
use
Nasqueron\Notifications\Jobs\FirePhabricatorNotification
;
class
NotificationListener
{
///
/// Distill services' payloads into notifications
///
/**
* Handles a Docker Hub payload event.
*
* @param DockerHubPayloadEvent $event
* @return void
*/
public
function
onDockerHubPayload
(
DockerHubPayloadEvent
$event
)
{
$job
=
new
FireDockerHubNotification
(
$event
);
$job
->
handle
();
}
/**
* Handles a GitHub payload event.
*
* @param GitHubPayloadEvent $event
* @return void
*/
public
function
onGitHubPayload
(
GitHubPayloadEvent
$event
)
{
$job
=
new
FireGitHubNotification
(
$event
);
$job
->
handle
();
}
/**
* Handles a Phabricator payload event.
*
* @param PhabricatorPayloadEvent $event
* @return void
*/
public
function
onPhabricatorPayload
(
PhabricatorPayloadEvent
$event
)
{
$job
=
new
FirePhabricatorNotification
(
$event
);
$job
->
handle
();
}
/**
* Handles a Jenkins payload event.
*
* @param JenkinsPayloadEvent $event
* @return void
*/
public
function
onJenkinsPayload
(
JenkinsPayloadEvent
$event
)
{
$job
=
new
FireJenkinsNotification
(
$event
);
$job
->
handle
();
}
///
/// Events listening
///
/**
* Register the listeners for the subscriber.
*
* @param Illuminate\Events\Dispatcher $events
*/
public
function
subscribe
(
\Illuminate\Events\Dispatcher
$events
)
{
$class
=
'Nasqueron
\N
otifications
\L
isteners
\N
otificationListener'
;
$events
->
listen
(
'Nasqueron
\N
otifications
\E
vents
\D
ockerHubPayloadEvent'
,
"$class@onDockerHubPayload"
);
$events
->
listen
(
'Nasqueron
\N
otifications
\E
vents
\G
itHubPayloadEvent'
,
"$class@onGitHubPayload"
);
$events
->
listen
(
'Nasqueron
\N
otifications
\E
vents
\J
enkinsPayloadEvent'
,
"$class@onJenkinsPayload"
);
$events
->
listen
(
'Nasqueron
\N
otifications
\E
vents
\P
habricatorPayloadEvent'
,
"$class@onPhabricatorPayload"
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jul 28, 09:34 (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2790691
Default Alt Text
NotificationListener.php (2 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment