Path: blob/master/src/applications/owners/xaction/PhabricatorOwnersPackageNameTransaction.php
12256 views
<?php12final class PhabricatorOwnersPackageNameTransaction3extends PhabricatorOwnersPackageTransactionType {45const TRANSACTIONTYPE = 'owners.name';67public function generateOldValue($object) {8return $object->getName();9}1011public function validateTransactions($object, array $xactions) {12$errors = array();1314$missing = $this->isEmptyTextTransaction(15$object->getName(),16$xactions);1718if ($missing) {19$errors[] = $this->newRequiredError(20pht('Package name is required.'),21nonempty(last($xactions), null));22}2324foreach ($xactions as $xaction) {25$new = $xaction->getNewValue();26if (preg_match('([,!])', $new)) {27$errors[] = $this->newInvalidError(28pht(29'Package names may not contain commas (",") or exclamation '.30'marks ("!"). These characters are ambiguous when package '.31'names are parsed from the command line.'),32$xaction);33}34}3536return $errors;37}3839public function applyInternalEffects($object, $value) {40$object->setName($value);41}4243public function getTitle() {44return pht(45'%s renamed this package from %s to %s.',46$this->renderAuthor(),47$this->renderOldValue(),48$this->renderNewValue());49}5051}525354