Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90362699
DoorkeeperBridgeGitHub.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Oct 31, 23:51
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Nov 2, 23:51 (2 d)
Engine
blob
Format
Raw Data
Handle
22062366
Attached To
rPH Phabricator
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
],
);
}
}
Event Timeline
Log In to Comment