Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F10750795
CreateEvent.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
CreateEvent.php
View Options
<?php
namespace
Nasqueron\Notifications\Analyzers\GitHub\Events
;
/**
* CreateEvent payload analyzer
*
* We don't support the repository ref type, as, according the documentation,
* "webhooks will not receive this event for created repositories".webhooks
*
* Another case when we won't receive the event is when at least four tags are
* pushed at once.
*
* @link https://developer.github.com/v3/activity/events/types/#createevent
*/
class
CreateEvent
extends
Event
{
use
WithRef
;
/**
* Gets description for the payload
*
* @return string
*/
public
function
getDescription
()
:
string
{
$repository
=
$this
->
payload
->
repository
->
full_name
;
$type
=
$this
->
payload
->
ref_type
;
$ref
=
$this
->
payload
->
ref
;
if
(!
self
::
isValidRefType
(
$type
))
{
return
trans
(
'GitHub.EventsDescriptions.CreateEventUnknown'
,
[
'type'
=>
$type
,
'ref'
=>
$ref
,
]
);
}
return
trans
(
'GitHub.EventsDescriptions.CreateEvent'
,
[
'type'
=>
$type
,
'ref'
=>
$ref
,
'repository'
=>
$repository
,
]
);
}
/**
* Gets link segments for the type
*
* @return array
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/
private
function
getLinkRefSegments
()
:
array
{
return
[
'tag'
=>
'/releases/tag/'
,
'branch'
=>
'/tree/'
,
];
}
/**
* Gets link for the payload
*
* @return string
*/
public
function
getLink
()
:
string
{
$type
=
$this
->
payload
->
ref_type
;
$ref
=
$this
->
payload
->
ref
;
$url
=
$this
->
payload
->
repository
->
html_url
;
$url
.=
$this
->
getLinkRefSegment
(
$type
);
$url
.=
$ref
;
return
$url
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jul 27, 20:36 (11 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2828931
Default Alt Text
CreateEvent.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment