Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97579107
PhabricatorCountdownEpochTransaction.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, Jan 5, 10:29
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 10:29 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23430354
Attached To
rPH Phabricator
PhabricatorCountdownEpochTransaction.php
View Options
<?php
final
class
PhabricatorCountdownEpochTransaction
extends
PhabricatorCountdownTransactionType
{
const
TRANSACTIONTYPE
=
'countdown:epoch'
;
public
function
generateOldValue
(
$object
)
{
return
(
int
)
$object
->
getEpoch
();
}
public
function
generateNewValue
(
$object
,
$value
)
{
return
$value
->
newPhutilDateTime
()
->
newAbsoluteDateTime
()
->
getEpoch
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setEpoch
(
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s updated the countdown end from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldDate
(),
$this
->
renderNewDate
());
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s updated the countdown end for %s from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
(),
$this
->
renderOldDate
(),
$this
->
renderNewDate
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(!
$object
->
getEpoch
()
&&
!
$xactions
)
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'You must give the countdown an end date.'
));
return
$errors
;
}
foreach
(
$xactions
as
$xaction
)
{
$value
=
$xaction
->
getNewValue
();
if
(!
$value
->
isValid
())
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'You must give the countdown an end date.'
));
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment