Page MenuHomeDevCentral

FireJenkinsNotification.php
No OneTemporary

FireJenkinsNotification.php

<?php
namespace Nasqueron\Notifications\Jobs;
use Nasqueron\Notifications\Notifications\JenkinsNotification;
use Nasqueron\Notifications\Events\JenkinsPayloadEvent;
use Nasqueron\Notifications\Events\NotificationEvent;
use Nasqueron\Notifications\Jobs\Job;
use Event;
class FireJenkinsNotification extends Job {
/**
* @var JenkinsPayloadEvent;
*/
private $event;
/**
* Initializes a new instance of FireJenkinsNotification
*
* @param JenkinsPayloadEvent $event The event to notify
*/
public function __construct (JenkinsPayloadEvent $event) {
$this->event = $event;
}
///
/// Task
///
/**
* Executes the job.
*
* @return void
*/
public function handle() : void {
$notification = $this->createNotification();
if ($notification->shouldNotify()) {
Event::fire(new NotificationEvent($notification));
}
}
/**
* Creates a Jenkins notification
*
* @param JenkinsPayloadEvent $event
* @return \Nasqueron\Notifications\Notifications\Notification The notification
*/
protected function createNotification() : JenkinsNotification {
return new JenkinsNotification(
$this->event->door, // project
$this->event->payload // raw content
);
}
}

File Metadata

Mime Type
text/x-php
Expires
Sun, Jul 27, 20:37 (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2815340
Default Alt Text
FireJenkinsNotification.php (1 KB)

Event Timeline