Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94210977
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
Wed, Dec 4, 18:55
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Dec 6, 18:55 (2 d)
Engine
blob
Format
Raw Data
Handle
22758524
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