3 final class AlmanacInterfacePortTransaction
4 extends AlmanacInterfaceTransactionType
{
6 const TRANSACTIONTYPE
= 'almanac:interface:port';
8 public function generateOldValue($object) {
9 $port = $object->getPort();
18 public function applyInternalEffects($object, $value) {
19 $object->setPort((int)$value);
22 public function getTitle() {
24 '%s changed the port for this interface from %s to %s.',
25 $this->renderAuthor(),
26 $this->renderOldValue(),
27 $this->renderNewValue());
30 public function validateTransactions($object, array $xactions) {
33 if ($this->isEmptyTextTransaction($object->getPort(), $xactions)) {
34 $errors[] = $this->newRequiredError(
35 pht('Interfaces must have a port number.'));
38 foreach ($xactions as $xaction) {
39 $port = $xaction->getNewValue();
42 if ($port < 1 ||
$port > 65535) {
43 $errors[] = $this->newInvalidError(
44 pht('Port numbers must be between 1 and 65535, inclusive.'),