Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F559368
DoorkeeperBridgeGitHub.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DoorkeeperBridgeGitHub.php
View Options
<?php
abstract
class
DoorkeeperBridgeGitHub
extends
DoorkeeperBridge
{
const
APPTYPE_GITHUB
=
'github'
;
const
APPDOMAIN_GITHUB
=
'github.com'
;
public
function
canPullRef
(
DoorkeeperObjectRef
$ref
)
{
if
(
$ref
->
getApplicationType
()
!=
self
::
APPTYPE_GITHUB
)
{
return
false
;
}
if
(
$ref
->
getApplicationDomain
()
!=
self
::
APPDOMAIN_GITHUB
)
{
return
false
;
}
return
true
;
}
protected
function
getGitHubAccessToken
()
{
$context_token
=
$this
->
getContextProperty
(
'github.token'
);
if
(
$context_token
)
{
return
$context_token
->
openEnvelope
();
}
// TODO: Do a bunch of work to fetch the viewer's linked account if
// they have one.
return
$this
->
didFailOnMissingLink
();
}
protected
function
parseGitHubIssueID
(
$id
)
{
$matches
=
null
;
if
(!
preg_match
(
'(^([^/]+)/([^/]+)#([1-9]
\d
*)
\z
)'
,
$id
,
$matches
))
{
throw
new
Exception
(
pht
(
'GitHub Issue ID "%s" is not properly formatted. Expected an ID '
.
'in the form "owner/repository#123".'
,
$id
));
}
return
array
(
$matches
[
1
],
$matches
[
2
],
(
int
)
$matches
[
3
],
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 10:24 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
128248
Default Alt Text
DoorkeeperBridgeGitHub.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment