Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91727590
DifferentialReviewerProxy.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
Wed, Nov 13, 21:52
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Nov 15, 21:52 (2 d)
Engine
blob
Format
Raw Data
Handle
22313981
Attached To
rPH Phabricator
DifferentialReviewerProxy.php
View Options
<?php
final
class
DifferentialReviewerProxy
extends
Phobject
{
private
$reviewerPHID
;
private
$status
;
private
$diffID
;
private
$authority
=
array
();
public
function
__construct
(
$reviewer_phid
,
array
$edge_data
)
{
$this
->
reviewerPHID
=
$reviewer_phid
;
$this
->
status
=
idx
(
$edge_data
,
'status'
);
$this
->
diffID
=
idx
(
$edge_data
,
'diff'
);
}
public
function
getReviewerPHID
()
{
return
$this
->
reviewerPHID
;
}
public
function
getStatus
()
{
return
$this
->
status
;
}
public
function
getDiffID
()
{
return
$this
->
diffID
;
}
public
function
isUser
()
{
$user_type
=
PhabricatorPeopleUserPHIDType
::
TYPECONST
;
return
(
phid_get_type
(
$this
->
getReviewerPHID
())
==
$user_type
);
}
public
function
attachAuthority
(
PhabricatorUser
$user
,
$has_authority
)
{
$this
->
authority
[
$user
->
getPHID
()]
=
$has_authority
;
return
$this
;
}
public
function
hasAuthority
(
PhabricatorUser
$viewer
)
{
// It would be nice to use assertAttachedKey() here, but we don't extend
// PhabricatorLiskDAO, and faking that seems sketchy.
$viewer_phid
=
$viewer
->
getPHID
();
if
(!
array_key_exists
(
$viewer_phid
,
$this
->
authority
))
{
throw
new
Exception
(
pht
(
'You must %s first!'
,
'attachAuthority()'
));
}
return
$this
->
authority
[
$viewer_phid
];
}
public
function
getEdgeData
()
{
return
array
(
'status'
=>
$this
->
status
,
'diffID'
=>
$this
->
diffID
,
);
}
}
Event Timeline
Log In to Comment