Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106103259
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
Sat, Mar 22, 11:08
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Mar 24, 11:08 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25108727
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