Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F105984884
DifferentialReviewersCommitMessageField.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
Fri, Mar 21, 07:11
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Mar 23, 07:11 (2 d)
Engine
blob
Format
Raw Data
Handle
25090860
Attached To
rPH Phabricator
DifferentialReviewersCommitMessageField.php
View Options
<?php
final
class
DifferentialReviewersCommitMessageField
extends
DifferentialCommitMessageField
{
const
FIELDKEY
=
'reviewerPHIDs'
;
public
function
getFieldName
()
{
return
pht
(
'Reviewers'
);
}
public
function
getFieldAliases
()
{
return
array
(
'Reviewer'
,
);
}
public
function
parseFieldValue
(
$value
)
{
$results
=
$this
->
parseObjectList
(
$value
,
array
(
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
PhabricatorProjectProjectPHIDType
::
TYPECONST
,
PhabricatorOwnersPackagePHIDType
::
TYPECONST
,
),
false
,
array
(
'!'
));
return
$this
->
flattenReviewers
(
$results
);
}
private
function
flattenReviewers
(
array
$values
)
{
// NOTE: For now, `arc` relies on this field returning only scalars, so we
// need to reduce the results into scalars. See T10981.
$result
=
array
();
foreach
(
$values
as
$value
)
{
$result
[]
=
$value
[
'phid'
].
implode
(
''
,
array_keys
(
$value
[
'suffixes'
]));
}
return
$result
;
}
private
function
inflateReviewers
(
array
$values
)
{
$result
=
array
();
foreach
(
$values
as
$value
)
{
if
(
substr
(
$value
,
-
1
)
==
'!'
)
{
$value
=
substr
(
$value
,
0
,
-
1
);
$suffixes
=
array
(
'!'
=>
'!'
);
}
else
{
$suffixes
=
array
();
}
$result
[]
=
array
(
'phid'
=>
$value
,
'suffixes'
=>
$suffixes
,
);
}
return
$result
;
}
}
Event Timeline
Log In to Comment