Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F439740
PhortuneAccountNameTransaction.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
PhortuneAccountNameTransaction.php
View Options
<?php
final
class
PhortuneAccountNameTransaction
extends
PhortuneAccountTransactionType
{
const
TRANSACTIONTYPE
=
'phortune:name'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getName
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setName
(
$value
);
}
public
function
getTitle
()
{
$old
=
$this
->
getOldValue
();
$new
=
$this
->
getNewValue
();
if
(
phutil_nonempty_string
(
$old
)
&&
phutil_nonempty_string
(
$new
))
{
return
pht
(
'%s renamed this account from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderOldValue
(),
$this
->
renderNewValue
());
}
else
{
return
pht
(
'%s created this account.'
,
$this
->
renderAuthor
());
}
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getName
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Accounts must have a name.'
));
}
$max_length
=
$object
->
getColumnMaximumByteLength
(
'name'
);
foreach
(
$xactions
as
$xaction
)
{
$new_value
=
$xaction
->
getNewValue
();
$new_length
=
strlen
(
$new_value
);
if
(
$new_length
>
$max_length
)
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'The name can be no longer than %s characters.'
,
new
PhutilNumber
(
$max_length
)));
}
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 4:41 AM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
63925
Default Alt Text
PhortuneAccountNameTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment