Page MenuHomeDevCentral

NotificationListener.php
No OneTemporary

NotificationListener.php

<?php
namespace Nasqueron\Notifications\Listeners;
use Nasqueron\Notifications\Events\DockerHubPayloadEvent;
use Nasqueron\Notifications\Events\GitHubPayloadEvent;
use Nasqueron\Notifications\Events\PhabricatorPayloadEvent;
use Nasqueron\Notifications\Jobs\FireDockerHubNotification;
use Nasqueron\Notifications\Jobs\FireGitHubNotification;
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();
}
///
/// Events listening
///
/**
* Register the listeners for the subscriber.
*
* @param Illuminate\Events\Dispatcher $events
*/
public function subscribe (\Illuminate\Events\Dispatcher $events) {
$class = 'Nasqueron\Notifications\Listeners\NotificationListener';
$events->listen(
'Nasqueron\Notifications\Events\DockerHubPayloadEvent',
"$class@onDockerHubPayload"
);
$events->listen(
'Nasqueron\Notifications\Events\GitHubPayloadEvent',
"$class@onGitHubPayload"
);
$events->listen(
'Nasqueron\Notifications\Events\PhabricatorPayloadEvent',
"$class@onPhabricatorPayload"
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Jun 26, 05:11 (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2759850
Default Alt Text
NotificationListener.php (2 KB)

Event Timeline