Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F81575827
PhabricatorOwnersPackageAutoreviewTransaction.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, Sep 6, 20:24
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Sep 8, 20:24 (2 d)
Engine
blob
Format
Raw Data
Handle
20598095
Attached To
rPH Phabricator
PhabricatorOwnersPackageAutoreviewTransaction.php
View Options
<?php
final
class
PhabricatorOwnersPackageAutoreviewTransaction
extends
PhabricatorOwnersPackageTransactionType
{
const
TRANSACTIONTYPE
=
'owners.autoreview'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getAutoReview
();
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$map
=
PhabricatorOwnersPackage
::
getAutoreviewOptionsMap
();
foreach
(
$xactions
as
$xaction
)
{
$new
=
$xaction
->
getNewValue
();
if
(
empty
(
$map
[
$new
]))
{
$valid
=
array_keys
(
$map
);
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Autoreview setting "%s" is not valid. '
.
'Valid settings are: %s.'
,
$new
,
implode
(
', '
,
$valid
)),
$xaction
);
}
}
return
$errors
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setAutoReview
(
$value
);
}
public
function
getTitle
()
{
$map
=
PhabricatorOwnersPackage
::
getAutoreviewOptionsMap
();
$map
=
ipull
(
$map
,
'name'
);
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
$old
=
idx
(
$map
,
$old
,
$old
);
$new
=
idx
(
$map
,
$new
,
$new
);
return
pht
(
'%s adjusted autoreview from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderValue
(
$old
),
$this
->
renderValue
(
$new
));
}
}
Event Timeline
Log In to Comment