Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F108031750
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
Sun, Apr 13, 09:51
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Apr 15, 09:51 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25515024
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