Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96588399
PhabricatorPackagesPublisherKeyTransaction.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
Sat, Dec 28, 14:56
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 30, 14:56 (2 d)
Engine
blob
Format
Raw Data
Handle
23212638
Attached To
rPH Phabricator
PhabricatorPackagesPublisherKeyTransaction.php
View Options
<?php
final
class
PhabricatorPackagesPublisherKeyTransaction
extends
PhabricatorPackagesPublisherTransactionType
{
const
TRANSACTIONTYPE
=
'packages.publisher.key'
;
public
function
generateOldValue
(
$object
)
{
return
$object
->
getPublisherKey
();
}
public
function
applyInternalEffects
(
$object
,
$value
)
{
$object
->
setPublisherKey
(
$value
);
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
if
(
$this
->
isEmptyTextTransaction
(
$object
->
getName
(),
$xactions
))
{
$errors
[]
=
$this
->
newRequiredError
(
pht
(
'Publishers must have a unique publisher key.'
));
}
if
(!
$this
->
isNewObject
())
{
foreach
(
$xactions
as
$xaction
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Once a publisher is created, its key can not be changed.'
),
$xaction
);
}
}
foreach
(
$xactions
as
$xaction
)
{
$value
=
$xaction
->
getNewValue
();
try
{
PhabricatorPackagesPublisher
::
assertValidPublisherKey
(
$value
);
}
catch
(
Exception
$ex
)
{
$errors
[]
=
$this
->
newInvalidError
(
$ex
->
getMessage
(),
$xaction
);
}
}
return
$errors
;
}
}
Event Timeline
Log In to Comment