Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F9790203
IssueCommentEvent.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
IssueCommentEvent.php
View Options
<?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
Details
Attached
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)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment