Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / countdown / xaction / PhabricatorCountdownEpochTransaction.php
blob905e0771d8d61bbd118fe14118a8d42551c46f04
1 <?php
3 final class PhabricatorCountdownEpochTransaction
4 extends PhabricatorCountdownTransactionType {
6 const TRANSACTIONTYPE = 'countdown:epoch';
8 public function generateOldValue($object) {
9 return (int)$object->getEpoch();
12 public function generateNewValue($object, $value) {
13 return $value->newPhutilDateTime()
14 ->newAbsoluteDateTime()
15 ->getEpoch();
18 public function applyInternalEffects($object, $value) {
19 $object->setEpoch($value);
22 public function getTitle() {
23 return pht(
24 '%s updated the countdown end from %s to %s.',
25 $this->renderAuthor(),
26 $this->renderOldDate(),
27 $this->renderNewDate());
30 public function getTitleForFeed() {
31 return pht(
32 '%s updated the countdown end for %s from %s to %s.',
33 $this->renderAuthor(),
34 $this->renderObject(),
35 $this->renderOldDate(),
36 $this->renderNewDate());
39 public function validateTransactions($object, array $xactions) {
40 $errors = array();
42 if (!$object->getEpoch() && !$xactions) {
43 $errors[] = $this->newRequiredError(
44 pht('You must give the countdown an end date.'));
45 return $errors;
48 foreach ($xactions as $xaction) {
49 $value = $xaction->getNewValue();
50 if (!$value->isValid()) {
51 $errors[] = $this->newInvalidError(
52 pht('You must give the countdown an end date.'));
56 return $errors;