Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F4793859
PhabricatorNotification.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
PhabricatorNotification.php
View Options
<?php
namespace
Nasqueron\Notifications\Notifications
;
use
Nasqueron\Notifications\Analyzers\Phabricator\PhabricatorPayloadAnalyzer
;
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-php
Expires
Fri, Feb 28, 22:47 (23 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2439243
Default Alt Text
PhabricatorNotification.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment