Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F471008
AlmanacInterfacePortTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
AlmanacInterfacePortTransaction.php
View Options
<?php
final
class
AlmanacInterfacePortTransaction
extends
AlmanacInterfaceTransactionType
{
const
TRANSACTIONTYPE
=
'almanac:interface:port'
;
public
function
generateOldValue
(
$object
)
{
$port
=
$object
->
getPort
();
if
(
$port
!==
null
)
{
$port
=
(
int
)
$port
;
}
return
$port
;
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setPort
((
int
)
$value
);
}
public
function
getTitle
()
{
return
pht
(
'%s changed the port for this interface from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getPort
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Interfaces must have a port number.'
));
}
foreach
(
$xactions
as
$xaction
)
{
$port
=
$xaction
->
getNewValue
();
$port
=
(
int
)
$port
;
if
(
$port
<
1
||
$port
>
65535
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Port numbers must be between 1 and 65535, inclusive.'
),
$xaction
);
continue
;
}
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 6, 12:57 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
82073
Default Alt Text
AlmanacInterfacePortTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment