Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3942381
GitHubNotification.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
GitHubNotification.php
View Options
<?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
Details
Attached
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)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment