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 PhabricatorCalendarExportModeTransaction extends PhabricatorCalendarE..

Decoded Output download

<?php

final class PhabricatorCalendarExportModeTransaction
  extends PhabricatorCalendarExportTransactionType {

  const TRANSACTIONTYPE = 'calendar.export.mode';

  public function generateOldValue($object) {
    return $object->getPolicyMode();
  }

  public function applyInternalEffects($object, $value) {
    $object->setPolicyMode($value);
  }

  public function getTitle() {
    $old_value = $this->getOldValue();
    $new_value = $this->getNewValue();

    $old_name = PhabricatorCalendarExport::getPolicyModeName($old_value);
    $new_name = PhabricatorCalendarExport::getPolicyModeName($new_value);

    return pht(
      '%s changed the policy mode for this export from %s to %s.',
      $this->renderAuthor(),
      $this->renderValue($old_name),
      $this->renderValue($new_name));
  }

  public function validateTransactions($object, array $xactions) {
    $errors = array();

    $valid = PhabricatorCalendarExport::getPolicyModes();
    $valid = array_fuse($valid);

    foreach ($xactions as $xaction) {
      $value = $xaction->getNewValue();

      if (isset($valid[$value])) {
        continue;
      }

      $errors[] = $this->newInvalidError(
        pht(
          'Mode "%s" is not a valid policy mode. Valid modes are: %s.',
          $value,
          implode(', ', $valid)),
        $xaction);
    }

    return $errors;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorCalendarExportModeTransaction
  extends PhabricatorCalendarExportTransactionType {

  const TRANSACTIONTYPE = 'calendar.export.mode';

  public function generateOldValue($object) {
    return $object->getPolicyMode();
  }

  public function applyInternalEffects($object, $value) {
    $object->setPolicyMode($value);
  }

  public function getTitle() {
    $old_value = $this->getOldValue();
    $new_value = $this->getNewValue();

    $old_name = PhabricatorCalendarExport::getPolicyModeName($old_value);
    $new_name = PhabricatorCalendarExport::getPolicyModeName($new_value);

    return pht(
      '%s changed the policy mode for this export from %s to %s.',
      $this->renderAuthor(),
      $this->renderValue($old_name),
      $this->renderValue($new_name));
  }

  public function validateTransactions($object, array $xactions) {
    $errors = array();

    $valid = PhabricatorCalendarExport::getPolicyModes();
    $valid = array_fuse($valid);

    foreach ($xactions as $xaction) {
      $value = $xaction->getNewValue();

      if (isset($valid[$value])) {
        continue;
      }

      $errors[] = $this->newInvalidError(
        pht(
          'Mode "%s" is not a valid policy mode. Valid modes are: %s.',
          $value,
          implode(', ', $valid)),
        $xaction);
    }

    return $errors;
  }

}

Function Calls

None

Variables

None

Stats

MD5 040c5688ca41a9af2faa6e52a964f35f
Eval Count 0
Decode Time 83 ms