Path: blob/master/src/applications/packages/xaction/publisher/PhabricatorPackagesPublisherNameTransaction.php
12242 views
<?php12final class PhabricatorPackagesPublisherNameTransaction3extends PhabricatorPackagesPublisherTransactionType {45const TRANSACTIONTYPE = 'packages.publisher.name';67public function generateOldValue($object) {8return $object->getName();9}1011public function applyInternalEffects($object, $value) {12$object->setName($value);13}1415public function getTitle() {16return pht(17'%s changed the name of this publisher from %s to %s.',18$this->renderAuthor(),19$this->renderOldValue(),20$this->renderNewValue());21}2223public function getTitleForFeed() {24return pht(25'%s updated the name for %s from %s to %s.',26$this->renderAuthor(),27$this->renderObject(),28$this->renderOldValue(),29$this->renderNewValue());30}3132public function validateTransactions($object, array $xactions) {33$errors = array();3435if ($this->isEmptyTextTransaction($object->getName(), $xactions)) {36$errors[] = $this->newRequiredError(37pht('Publishers must have a name.'));38}3940foreach ($xactions as $xaction) {41$value = $xaction->getNewValue();42try {43PhabricatorPackagesPublisher::assertValidPublisherName($value);44} catch (Exception $ex) {45$errors[] = $this->newInvalidError($ex->getMessage(), $xaction);46}47}4849return $errors;50}5152}535455