Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / calendar / xaction / PhabricatorCalendarImportFrequencyTransaction.php
blob9fc68a3497ebd7ff424bc357c476ac7493b816b6
1 <?php
3 final class PhabricatorCalendarImportFrequencyTransaction
4 extends PhabricatorCalendarImportTransactionType {
6 const TRANSACTIONTYPE = 'calendar.import.frequency';
8 public function generateOldValue($object) {
9 return $object->getTriggerFrequency();
12 public function applyInternalEffects($object, $value) {
13 $object->setTriggerFrequency($value);
16 public function getTitle() {
17 return pht(
18 '%s changed the automatic update frequency for this import.',
19 $this->renderAuthor());
22 public function validateTransactions($object, array $xactions) {
23 $errors = array();
25 $frequency_map = PhabricatorCalendarImport::getTriggerFrequencyMap();
26 $valid = array_keys($frequency_map);
27 $valid = array_fuse($valid);
29 foreach ($xactions as $xaction) {
30 $value = $xaction->getNewValue();
32 if (!isset($valid[$value])) {
33 $errors[] = $this->newInvalidError(
34 pht(
35 'Import frequency "%s" is not valid. Valid frequencies are: %s.',
36 $value,
37 implode(', ', $valid)),
38 $xaction);
42 return $errors;