Page MenuHomeDevCentral

IssueCommentEvent.php
No OneTemporary

IssueCommentEvent.php

<?php
namespace Nasqueron\Notifications\Analyzers\GitHub\Events;
/**
* IssueCommentEvent payload analyzer
*
* @link https://developer.github.com/v3/activity/events/types/#issuecommentevent
*/
class IssueCommentEvent extends Event {
/**
* Determines if the action is valid.
*
* @param string $action The action to check
* @return bool true if the action is valid; otherwise, false
*/
protected static function isValidAction ($action) {
$actions = ['created', 'edited', 'deleted'];
return in_array($action, $actions);
}
/**
* Gets description for the payload.
*
* @return string
*/
public function getDescription () : string {
$action = $this->payload->action;
if (!static::isValidAction($action)) {
return trans(
'GitHub.EventsDescriptions.IssueCommentEventUnknown',
['action' => $action]
);
}
$key = 'GitHub.EventsDescriptions.IssueCommentEventPerAction.';
$key .= $action;
$comment = $this->payload->comment;
$issue = $this->payload->issue;
return trans(
$key,
[
'author' => $comment->user->login,
'issueNumber' => $issue->number,
'issueTitle' => $issue->title,
'excerpt' => self::cut($comment->body),
]
);
}
/**
* Gets link for the payload.
*
* @return string
*/
public function getLink () : string {
return $this->payload->comment->html_url;
}
}

File Metadata

Mime Type
text/x-php
Expires
Mon, Jun 16, 00:07 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2724853
Default Alt Text
IssueCommentEvent.php (1 KB)

Event Timeline