Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102109730
PhabricatorPasteLanguageTransaction.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Feb 17, 05:09
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Feb 19, 05:09 (2 d)
Engine
blob
Format
Raw Data
Handle
24283759
Attached To
rPH Phabricator
PhabricatorPasteLanguageTransaction.php
View Options
<?php
final
class
PhabricatorPasteLanguageTransaction
extends
PhabricatorPasteTransactionType
{
const
TRANSACTIONTYPE
=
'paste.language'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getLanguage
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setLanguage
(
$value
);
}
private
function
renderLanguageValue
(
$value
)
{
if
(!
strlen
(
$value
))
{
return
$this
->
renderValue
(
pht
(
'autodetect'
));
}
else
{
return
$this
->
renderValue
(
$value
);
}
}
public
function
getTitle
()
{
return
pht
(
"%s updated the paste's language from %s to %s."
,
$this
->
renderAuthor
(),
$this
->
renderLanguageValue
(
$this
->
getOldValue
()),
$this
->
renderLanguageValue
(
$this
->
getNewValue
()));
}
public
function
getTitleForFeed
()
{
return
pht
(
'%s updated the language for %s from %s to %s.'
,
$this
->
renderAuthor
(),
$this
->
renderObject
(),
$this
->
renderLanguageValue
(
$this
->
getOldValue
()),
$this
->
renderLanguageValue
(
$this
->
getNewValue
()));
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
foreach
(
$xactions
as
$xaction
)
{
$new
=
$xaction
->
getNewValue
();
if
(
$new
!==
null
&&
!
strlen
(
$new
))
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Paste language must be null or a nonempty string.'
),
$xaction
);
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment