Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3767913
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
29 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/app/Console/Commands/NotificationsPayload.php b/app/Console/Commands/NotificationsPayload.php
index 78deb6e..15316b7 100644
--- a/app/Console/Commands/NotificationsPayload.php
+++ b/app/Console/Commands/NotificationsPayload.php
@@ -1,214 +1,214 @@
<?php
namespace Nasqueron\Notifications\Console\Commands;
-use Nasqueron\Notifications\Notification;
+use Nasqueron\Notifications\Notifications\Notification;
use Nasqueron\Notifications\Phabricator\PhabricatorStory;
use Illuminate\Console\Command;
use InvalidArgumentException;
use ReflectionClass;
class NotificationsPayload extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'notifications:payload {service} {payload} {args*}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Gets a notification payload from a service payload';
/**
* The service to handle a payload for.
*
* @var string
*/
private $service;
/**
* The payload.
*
* @var string
*/
private $payload;
/**
* The parameters to pass to the notifications class constructor.
*
* An array with arguments' names as keys, arguments' values as values.
*
* @var array
*/
private $constructor;
/**
* Executes the console command.
*/
public function handle() : void {
if ($this->parseArguments()) {
$this->printNotification();
}
}
/**
* Parses arguments passed to the command.
*
* @return bool true if arguments looks good; otherwise, false.
*/
private function parseArguments () : bool {
try {
$this->parseService();
$this->parsePayload();
$this->parseConstructorParameters();
} catch (InvalidArgumentException $ex) {
$this->error($ex->getMessage());
return false;
}
return true;
}
/**
* Parses service argument.
*
* Fills it to the service property.
*
* @throws InvalidArgumentException when a notification class can't be found for the requested service.
*/
private function parseService () : void {
$this->service = $this->argument('service');
if (!class_exists($this->getNotificationClass())) {
throw new InvalidArgumentException("Unknown service: $this->service");
}
}
/**
* Parses path to the payload argument.
*
* Fills the content of the file to the payload property.
*
* @throws InvalidArgumentException when payload file is not found.
*/
private function parsePayload () : void {
$payloadFile = $this->argument('payload');
if (!file_exists($payloadFile)) {
throw new InvalidArgumentException("File not found: $payloadFile");
}
$this->payload = file_get_contents($payloadFile);
}
/**
* Parses all the extra arguments and sets the constructor property
* as an array of constructor arguments.
*
* @throws InvalidArgumentException when too many or too few arguments have been given.
*/
private function parseConstructorParameters () : void {
$keys = $this->getNotificationConstructorParameters();
$values = $this->argument('args');
$values['payload'] = $this->payload;
$this->constructor = self::argumentsArrayCombine($keys, $values);
$this->constructor['payload'] = $this->formatPayload();
}
/**
* Formats payload to pass to constructor
*
* @return PhabricatorStory|stdClass A deserialization of the payload
*/
private function formatPayload() {
if ($this->service === "Phabricator") {
$project = $this->constructor['project'];
return PhabricatorStory::loadFromJson($project, $this->payload);
}
return json_decode($this->payload);
}
/**
* Creates an array by using one array for keys and another for its values.
*
* @param array $keys
* @param array $values
* @return array
*
* @throws InvalidArgumentException when keys and values counts don't match
*/
public static function argumentsArrayCombine (array $keys, array $values) : array {
$countKeys = count($keys);
$countValues = count($values);
if ($countKeys != $countValues) {
throw new InvalidArgumentException("Number of arguments mismatch: got $countValues but expected $countKeys.");
}
return array_combine($keys, $values);
}
/**
* Initializes a new instance of the relevant notification class,
* with the arguments given in the constructor property.
*
- * @return \Nasqueron\Notifications\Notification
+ * @return \Nasqueron\Notifications\Notifications\Notification
*/
private function getNotification () : Notification {
$class = $this->getNotificationClass();
$args = array_values($this->constructor);
return new $class(...$args);
}
/**
* Gets the notification in JSON format.
*
* @return string
*/
private function formatNotification () : string {
return json_encode($this->getNotification(), JSON_PRETTY_PRINT);
}
/**
* Prints the notification for the service, payload and specified arguments.
*/
private function printNotification () : void {
$this->line($this->formatNotification());
}
/**
* Gets the notification class for the specified service.
*
* @return string
*/
private function getNotificationClass () : string {
$namespace = "Nasqueron\Notifications\Notifications\\";
return $namespace . $this->service . "Notification";
}
/**
* Gets an array with the parameters to pass to the constructor
* of the notification class for the specified service.
*
* @return array
*/
private function getNotificationConstructorParameters () : array {
$parameters = [];
$class = new ReflectionClass($this->getNotificationClass());
foreach ($class->getConstructor()->getParameters() as $parameter) {
$parameters[] = $parameter->getName();
}
return $parameters;
}
}
diff --git a/app/Events/NotificationEvent.php b/app/Events/NotificationEvent.php
index a27b709..7f476bb 100644
--- a/app/Events/NotificationEvent.php
+++ b/app/Events/NotificationEvent.php
@@ -1,25 +1,26 @@
<?php
namespace Nasqueron\Notifications\Events;
-use Nasqueron\Notifications\Notification;
use Nasqueron\Notifications\Events\Event;
+use Nasqueron\Notifications\Notifications\Notification;
+
use Illuminate\Queue\SerializesModels;
class NotificationEvent extends Event {
use SerializesModels;
/**
- * @var \Nasqueron\Notifications\Notification
+ * @var Notification
*/
public $notification;
/**
* Creates a new event instance.
*
* @param Notification $notification the notification
*/
public function __construct(Notification $notification) {
$this->notification = $notification;
}
}
diff --git a/app/Jobs/FireDockerHubNotification.php b/app/Jobs/FireDockerHubNotification.php
index 1b035ec..7c79f84 100644
--- a/app/Jobs/FireDockerHubNotification.php
+++ b/app/Jobs/FireDockerHubNotification.php
@@ -1,53 +1,53 @@
<?php
namespace Nasqueron\Notifications\Jobs;
use Nasqueron\Notifications\Notifications\DockerHubNotification;
use Nasqueron\Notifications\Events\DockerHubPayloadEvent;
use Nasqueron\Notifications\Events\NotificationEvent;
use Nasqueron\Notifications\Jobs\Job;
use Event;
class FireDockerHubNotification extends Job {
/**
* @var DockerHubPayloadEvent;
*/
private $event;
/**
* Initializes a new instance of FireDockerHubNotification
*
* @param DockerHubPayloadEvent $event The event to notify
*/
public function __construct (DockerHubPayloadEvent $event) {
$this->event = $event;
}
///
/// Task
///
/**
* Executes the job.
*/
public function handle() : void {
$notification = $this->createNotification();
Event::fire(new NotificationEvent($notification));
}
/**
* Creates a DockerHub notification
*
* @param DockerHubPayloadEvent $event
- * @return \Nasqueron\Notifications\Notification The notification
+ * @return \Nasqueron\Notifications\Notifications\Notification The notification
*/
protected function createNotification() : DockerHubNotification {
return new DockerHubNotification(
$this->event->door, // project
$this->event->event, // event type
$this->event->payload // raw content
);
}
}
diff --git a/app/Jobs/FireGitHubNotification.php b/app/Jobs/FireGitHubNotification.php
index 234e90e..8df4d3d 100644
--- a/app/Jobs/FireGitHubNotification.php
+++ b/app/Jobs/FireGitHubNotification.php
@@ -1,53 +1,53 @@
<?php
namespace Nasqueron\Notifications\Jobs;
use Nasqueron\Notifications\Notifications\GitHubNotification;
use Nasqueron\Notifications\Events\GitHubPayloadEvent;
use Nasqueron\Notifications\Events\NotificationEvent;
use Nasqueron\Notifications\Jobs\Job;
use Event;
class FireGitHubNotification extends Job {
/**
* @var GitHubPayloadEvent;
*/
private $event;
/**
* Initializes a new instance of FireGitHubNotification
*
* @param GitHubPayloadEvent $event The event to notify
*/
public function __construct (GitHubPayloadEvent $event) {
$this->event = $event;
}
///
/// Task
///
/**
* Executes the job.
*/
public function handle() : void {
$notification = $this->createNotification();
Event::fire(new NotificationEvent($notification));
}
/**
* Creates a GitHub notification
*
* @param GitHubPayloadEvent $event
- * @return \Nasqueron\Notifications\Notification The notification
+ * @return \Nasqueron\Notifications\Notifications\Notification The notification
*/
protected function createNotification() : GitHubNotification {
return new GitHubNotification(
$this->event->door, // project
$this->event->event, // event type
$this->event->payload // raw content
);
}
}
diff --git a/app/Jobs/FireJenkinsNotification.php b/app/Jobs/FireJenkinsNotification.php
index 48f1d0d..d7346de 100644
--- a/app/Jobs/FireJenkinsNotification.php
+++ b/app/Jobs/FireJenkinsNotification.php
@@ -1,56 +1,56 @@
<?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\Notification The notification
+ * @return \Nasqueron\Notifications\Notifications\Notification The notification
*/
protected function createNotification() : JenkinsNotification {
return new JenkinsNotification(
$this->event->door, // project
$this->event->payload // raw content
);
}
}
diff --git a/app/Jobs/FirePhabricatorNotification.php b/app/Jobs/FirePhabricatorNotification.php
index b513bad..eb717b6 100644
--- a/app/Jobs/FirePhabricatorNotification.php
+++ b/app/Jobs/FirePhabricatorNotification.php
@@ -1,52 +1,52 @@
<?php
namespace Nasqueron\Notifications\Jobs;
use Nasqueron\Notifications\Notifications\PhabricatorNotification;
use Nasqueron\Notifications\Events\PhabricatorPayloadEvent;
use Nasqueron\Notifications\Events\NotificationEvent;
use Nasqueron\Notifications\Jobs\Job;
use Event;
class FirePhabricatorNotification extends Job {
/**
* @var PhabricatorPayloadEvent;
*/
private $event;
/**
* Initializes a new instance of FirePhabricatorNotification
*
* @param PhabricatorPayloadEvent $event The event to notify
*/
public function __construct (PhabricatorPayloadEvent $event) {
$this->event = $event;
}
///
/// Task
///
/**
* Executes the job.
*/
public function handle() : void {
$notification = $this->createNotification();
Event::fire(new NotificationEvent($notification));
}
/**
* Creates a Phabricator notification
*
* @param PhabricatorPayloadEvent $event
- * @return \Nasqueron\Notifications\Notification The notification
+ * @return \Nasqueron\Notifications\Notifications\Notification The notification
*/
protected function createNotification() : PhabricatorNotification {
return new PhabricatorNotification(
$this->event->door, // Project
$this->event->story // Story
);
}
}
diff --git a/app/Listeners/AMQPEventListener.php b/app/Listeners/AMQPEventListener.php
index 2b7a12e..756b518 100644
--- a/app/Listeners/AMQPEventListener.php
+++ b/app/Listeners/AMQPEventListener.php
@@ -1,138 +1,138 @@
<?php
namespace Nasqueron\Notifications\Listeners;
use Nasqueron\Notifications\Events\GitHubPayloadEvent;
use Nasqueron\Notifications\Events\NotificationEvent;
use Nasqueron\Notifications\Analyzers\GitHub\GitHubPayloadAnalyzer;
use Nasqueron\Notifications\Jobs\SendMessageToBroker;
-use Nasqueron\Notifications\Notification;
+use Nasqueron\Notifications\Notifications\Notification;
use Config;
class AMQPEventListener {
///
/// GitHub events
///
/**
* Gets routing key, to allow consumers to select the topic they subscribe to.
*
* @param GitHubPayloadEvent $event the payload event
*/
protected static function getGitHubEventRoutingKey (GitHubPayloadEvent $event) : string {
$key = [
strtolower($event->door),
self::getGroup($event),
$event->event
];
return implode('.', $key);
}
protected static function getAnalyzer (GitHubPayloadEvent $event) : GitHubPayloadAnalyzer {
return new GitHubPayloadAnalyzer(
$event->door,
$event->event,
$event->payload
);
}
/**
* Gets the group for a specific payload
*
* @return string the group, central part of the routing key
*/
protected static function getGroup (GitHubPayloadEvent $event) : string {
$analyzer = self::getAnalyzer($event);
return $analyzer->getGroup();
}
/**
* Handles a GitHub payload event.
*
* @param GitHubPayloadEvent $event
*/
public function onGitHubPayload(GitHubPayloadEvent $event) : void {
$this->sendRawPayload($event);
}
/**
* This is our gateway GitHub Webhooks -> Broker
*
* @param GitHubPayloadEvent $event
*/
protected function sendRawPayload(GitHubPayloadEvent $event) : void {
$target = Config::get('broker.targets.github_events');
$routingKey = static::getGitHubEventRoutingKey($event);
$message = json_encode($event->payload);
$job = new SendMessageToBroker($target, $routingKey, $message);
$job->handle();
}
///
/// Notifications
///
/**
* Handles a notification event.
*
* @param NotificationEvent $event
*/
public function onNotification(NotificationEvent $event) : void {
$this->sendNotification($event);
}
/**
* Gets routing key, to allow consumers to select the topic they subscribe to.
*
* @param NotificationEvent $event
*/
protected static function getNotificationRoutingKey (Notification $notification) : string {
$key = [
$notification->project,
$notification->group,
$notification->service,
$notification->type
];
return strtolower(implode('.', $key));
}
/**
* This is our gateway specialized for distilled notifications
*
* @param NotificationEvent $event
*/
protected function sendNotification(NotificationEvent $event) : void {
$notification = $event->notification;
$target = Config::get('broker.targets.notifications');
$routingKey = static::getNotificationRoutingKey($notification);
$message = json_encode($notification);
$job = new SendMessageToBroker($target, $routingKey, $message);
$job->handle();
}
///
/// Events listening
///
/**
* Register the listeners for the subscriber.
*
* @param \Illuminate\Events\Dispatcher $events
*/
public function subscribe (\Illuminate\Events\Dispatcher $events) : void {
$class = 'Nasqueron\Notifications\Listeners\AMQPEventListener';
$events->listen(
'Nasqueron\Notifications\Events\GitHubPayloadEvent',
"$class@onGitHubPayload"
);
$events->listen(
'Nasqueron\Notifications\Events\NotificationEvent',
"$class@onNotification"
);
}
}
diff --git a/app/Notifications/DockerHubNotification.php b/app/Notifications/DockerHubNotification.php
index 744fc07..e485677 100644
--- a/app/Notifications/DockerHubNotification.php
+++ b/app/Notifications/DockerHubNotification.php
@@ -1,88 +1,87 @@
<?php
namespace Nasqueron\Notifications\Notifications;
use Nasqueron\Notifications\Analyzers\DockerHub\BaseEvent;
-use Nasqueron\Notifications\Notification;
use InvalidArgumentException;
/**
* A Docker Hub notification.
*
* As we always sort them to the 'docker' group, and the registry only fires
* one kind of event, this is pretty straightforward without any need for
* configuration files or analyser class.
*
* HOW TO IMPLEMENT PAYLOADS SORT PER REPOSITORY?
*
* If you want to extend this to sort Docker images through some rules, we
* suggest you add a feature request to Docker to include source repository
* for the image, then call the GitHubPayloadAnalyzer with this repo instead
* of implementing a new one. This will allows to avoid to maintain two sets
* of configuration, one for the GitHub repos, one for the Docker repos.
*
* Even without that, you can probably be safe with a class or a method to map
* GitHub and Docker names, either because they are the same, either because
* there is a prefix: e.g. nasqueron/arcanist and nasqueron/docker-arcanist.
*/
class DockerHubNotification extends Notification {
public function __construct (string $project, string $event, \stdClass $payload) {
// Straightforward properties
$this->service = "DockerHub";
$this->project = $project;
$this->type = $event;
$this->rawContent = $payload;
$this->group = "docker";
// Properties from the payload
$this->analyzeByEvent();
}
///
/// Analyze by event
///
/**
* Fills properties from event payload.
*/
public function analyzeByEvent () : void {
$analyzer = $this->getAnalyzer();
$this->rawContent = $analyzer->getPayload();
$this->text = $analyzer->getText();
$this->link = $analyzer->getLink();
}
/**
* Gets analyzer class name for the current event.
*
* @return string
*/
private function getAnalyzerClassName () : string {
return "Nasqueron\Notifications\Analyzers\DockerHub\\"
. ucfirst($this->type)
. "Event";
}
/**
* Gets analyzer for the current event.
*
* @return \Nasqueron\Notifications\Analyzers\DockerHub\BaseEvent
*/
private function getAnalyzer () : BaseEvent {
$class = $this->getAnalyzerClassName();
if (!class_exists($class)) {
throw new InvalidArgumentException(
"Event $this->type doesn't have a matching $class class."
);
}
return new $class($this->rawContent);
}
}
diff --git a/app/Notifications/GitHubNotification.php b/app/Notifications/GitHubNotification.php
index 3099ceb..344d9b3 100644
--- a/app/Notifications/GitHubNotification.php
+++ b/app/Notifications/GitHubNotification.php
@@ -1,69 +1,68 @@
<?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();
}
}
diff --git a/app/Notifications/JenkinsNotification.php b/app/Notifications/JenkinsNotification.php
index d65fb64..56fae37 100644
--- a/app/Notifications/JenkinsNotification.php
+++ b/app/Notifications/JenkinsNotification.php
@@ -1,112 +1,111 @@
<?php
namespace Nasqueron\Notifications\Notifications;
use Nasqueron\Notifications\Analyzers\Jenkins\JenkinsPayloadAnalyzer;
-use Nasqueron\Notifications\Notification;
/**
* A Jenkins notification.
*
* This handles the JSON payloads sent by the following plugin:
* https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin
*/
class JenkinsNotification extends Notification {
/**
* @var \Nasqueron\Notifications\Analyzers\Jenkins\JenkinsPayloadAnalyzer
*/
private $analyzer = null;
/**
* Initializes a new instance of the JenkinsNotification class.
*
* @param string $project The project this message is for
* @param mixed $payload The message fired by Jenkins notification plugin
*/
public function __construct ($project, $payload) {
// Straightforward properties
$this->service = "Jenkins";
$this->project = $project;
$this->rawContent = $payload;
// Properties from the payload
$this->group = $this->getGroup();
$this->text = $this->getText();
$this->link = $payload->build->full_url;
$this->type = $this->getType();
}
/**
* Gets the notification type.
*
* @return string
*/
public function getType () : string {
$build = $this->rawContent->build;
$type = strtolower($build->phase);
if (property_exists($build, 'status')) {
$type .= '.';
$type .= $build->status;
}
return strtolower($type);
}
/**
* Gets the notification text. Intended to convey a short message (thing Twitter or IRC).
*
* @return string
*/
public function getText () : string {
$name = $this->rawContent->name;
$build = $this->rawContent->build;
$phase = strtolower($build->phase);
$text = "Jenkins job $name has been $phase";
if (property_exists($build, 'status')) {
$status = strtolower($build->status);
$text .= ": $status";
}
return $text;
}
/**
* Gets analyzer
*
* @return \Nasqueron\Notifications\Analyzers\Jenkins\JenkinsPayloadAnalyzer
*/
private function getAnalyzer () : JenkinsPayloadAnalyzer {
if ($this->analyzer === null) {
$this->analyzer = new JenkinsPayloadAnalyzer(
$this->project,
$this->rawContent
);
}
return $this->analyzer;
}
/**
* Gets the notification group.
*
* @return string
*/
public function getGroup () : string {
return $this->getAnalyzer()->getGroup();
}
/**
* Indicates if we should handle this payload to trigger a notification.
*
* @return bool if false, this payload is to be ignored for notifications
*/
public function shouldNotify () : bool {
return $this->getAnalyzer()->shouldNotify();
}
}
diff --git a/app/Notification.php b/app/Notifications/Notification.php
similarity index 95%
rename from app/Notification.php
rename to app/Notifications/Notification.php
index 33ce549..1f7e285 100644
--- a/app/Notification.php
+++ b/app/Notifications/Notification.php
@@ -1,68 +1,68 @@
<?php
-namespace Nasqueron\Notifications;
+namespace Nasqueron\Notifications\Notifications;
class Notification {
///
/// From who?
///
/**
* The notification's source service (e.g. GitHub, Phabricator, Jenkins)
*
* @var string
*/
public $service;
///
/// For whom?
///
/**
* The notification's target project (e.g. Wikimedia Nasqueron, Wolfplex)
*
* @var string
*/
public $project;
/**
* The notification's target group (e.g. Tasacora, Operations)
*
* @var string
*/
public $group;
///
/// WHAT?
///
/**
* The notification's source payload, data or message
*
* @var mixed
*/
public $rawContent;
/**
* The notification's type (e.g. "commits", "task")
*
* @var string
*/
public $type;
/**
* The notification's text
*
* @var string
*/
public $text;
/**
* The notification's URL, to be used as the main link for widgets
*
* @var string
*/
public $link;
}
diff --git a/app/Notifications/PhabricatorNotification.php b/app/Notifications/PhabricatorNotification.php
index e3243ea..697a5ce 100644
--- a/app/Notifications/PhabricatorNotification.php
+++ b/app/Notifications/PhabricatorNotification.php
@@ -1,68 +1,67 @@
<?php
namespace Nasqueron\Notifications\Notifications;
use Nasqueron\Notifications\Analyzers\Phabricator\PhabricatorPayloadAnalyzer;
-use Nasqueron\Notifications\Notification;
use Nasqueron\Notifications\Phabricator\PhabricatorStory;
class PhabricatorNotification extends Notification {
/**
* @var PhabricatorPayloadAnalyzer
*/
private $analyzer = null;
/**
* Initializes a new PhabricatorNotification instance
*
* @param string $project The project for this notification
* @param PhabricatorStory $payload The story to convert into a notification
*/
public function __construct (string $project, PhabricatorStory $payload) {
// Straightforward properties
$this->service = "Phabricator";
$this->project = $project;
$this->rawContent = $payload;
$this->text = $payload->text;
// Analyzes and fills
$this->type = $payload->getObjectType();
$this->group = $this->getGroup();
$this->link = $this->getLink();
}
/**
* Gets analyzer
*
* @return \Nasqueron\Notifications\Analyzers\Phabricator\PhabricatorPayloadAnalyzer
*/
private function getAnalyzer () : PhabricatorPayloadAnalyzer {
if ($this->analyzer === null) {
$this->analyzer = new PhabricatorPayloadAnalyzer(
$this->project,
$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 URL. Intended to be a widget or icon link.
*
* @return string
*/
public function getLink () : string {
return "";
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Nov 25, 04:14 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259508
Default Alt Text
(29 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment