Page MenuHomeDevCentral

GitHubNotification.php
No OneTemporary

GitHubNotification.php

<?php
namespace Nasqueron\Notifications\Notifications;
use Nasqueron\Notifications\Analyzers\GitHub\GitHubPayloadAnalyzer;
use Nasqueron\Notifications\Notification;
class GitHubNotification extends Notification {
/**
* @var GitHubPayloadAnalyzer
*/
private $analyzer = null;
public function __construct (string $project, string $event, \stdClass $payload) {
// Straightforward properties
$this->service = "GitHub";
$this->project = $project;
$this->type = $event;
$this->rawContent = $payload;
// Analyzes and fills
$this->group = $this->getGroup();
$this->text = $this->getText();
$this->link = $this->getLink();
}
/**
* Gets analyzer
*/
private function getAnalyzer () : GitHubPayloadAnalyzer {
if ($this->analyzer === null) {
$this->analyzer = new GitHubPayloadAnalyzer(
$this->project,
$this->type,
$this->rawContent
);
}
return $this->analyzer;
}
/**
* Gets the target notificatrion group
*
* @return string the target group for the notification
*/
public function getGroup () : string {
return $this->getAnalyzer()->getGroup();
}
/**
* Gets the notification text. Intended to convey a short message (thing Twitter or IRC).
*
* @return string
*/
public function getText () : string {
return $this->getAnalyzer()->getDescription();
}
/**
* Gets the notification URL. Intended to be a widget or icon link.
*
* @return string
*/
public function getLink () : string {
return $this->getAnalyzer()->getLink();
}
}

File Metadata

Mime Type
text/x-php
Expires
Thu, Dec 26, 16:12 (7 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2315155
Default Alt Text
GitHubNotification.php (1 KB)

Event Timeline