Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / nuance / xaction / NuanceQueueNameTransaction.php
blobe9a9efcd938bf5e5b9a559d4ef8d1f888e7c6a69
1 <?php
3 final class NuanceQueueNameTransaction
4 extends NuanceQueueTransactionType {
6 const TRANSACTIONTYPE = 'nuance.queue.name';
8 public function generateOldValue($object) {
9 return $object->getName();
12 public function applyInternalEffects($object, $value) {
13 $object->setName($value);
16 public function getTitle() {
17 return pht(
18 '%s renamed this queue from %s to %s.',
19 $this->renderAuthor(),
20 $this->renderOldValue(),
21 $this->renderNewValue());
24 public function validateTransactions($object, array $xactions) {
25 $errors = array();
27 if ($this->isEmptyTextTransaction($object->getName(), $xactions)) {
28 $errors[] = $this->newRequiredError(
29 pht('Queues must have a name.'));
32 $max_length = $object->getColumnMaximumByteLength('name');
33 foreach ($xactions as $xaction) {
34 $new_value = $xaction->getNewValue();
35 $new_length = strlen($new_value);
36 if ($new_length > $max_length) {
37 $errors[] = $this->newInvalidError(
38 pht(
39 'Queue names must not be longer than %s character(s).',
40 new PhutilNumber($max_length)));
44 return $errors;