Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php final class PhabricatorPackagesPackageKeyTransaction extends PhabricatorPackagesP..
Decoded Output download
<?php
final class PhabricatorPackagesPackageKeyTransaction
extends PhabricatorPackagesPackageTransactionType {
const TRANSACTIONTYPE = 'packages.package.key';
public function generateOldValue($object) {
return $object->getPackageKey();
}
public function applyInternalEffects($object, $value) {
$object->setPackageKey($value);
}
public function validateTransactions($object, array $xactions) {
$errors = array();
if ($this->isEmptyTextTransaction($object->getName(), $xactions)) {
$errors[] = $this->newRequiredError(
pht(
'Each package provided by a publisher must have a '.
'unique package key.'));
return $errors;
}
if (!$this->isNewObject()) {
foreach ($xactions as $xaction) {
$errors[] = $this->newInvalidError(
pht('Once a package is created, its key can not be changed.'),
$xaction);
}
}
foreach ($xactions as $xaction) {
$value = $xaction->getNewValue();
try {
PhabricatorPackagesPackage::assertValidPackageKey($value);
} catch (Exception $ex) {
$errors[] = $this->newInvalidError($ex->getMessage(), $xaction);
}
}
return $errors;
}
}
?>
Did this file decode correctly?
Original Code
<?php
final class PhabricatorPackagesPackageKeyTransaction
extends PhabricatorPackagesPackageTransactionType {
const TRANSACTIONTYPE = 'packages.package.key';
public function generateOldValue($object) {
return $object->getPackageKey();
}
public function applyInternalEffects($object, $value) {
$object->setPackageKey($value);
}
public function validateTransactions($object, array $xactions) {
$errors = array();
if ($this->isEmptyTextTransaction($object->getName(), $xactions)) {
$errors[] = $this->newRequiredError(
pht(
'Each package provided by a publisher must have a '.
'unique package key.'));
return $errors;
}
if (!$this->isNewObject()) {
foreach ($xactions as $xaction) {
$errors[] = $this->newInvalidError(
pht('Once a package is created, its key can not be changed.'),
$xaction);
}
}
foreach ($xactions as $xaction) {
$value = $xaction->getNewValue();
try {
PhabricatorPackagesPackage::assertValidPackageKey($value);
} catch (Exception $ex) {
$errors[] = $this->newInvalidError($ex->getMessage(), $xaction);
}
}
return $errors;
}
}
Function Calls
None |
Stats
MD5 | 580bdb67952c461d04e0892d84e62531 |
Eval Count | 0 |
Decode Time | 98 ms |