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 PhabricatorCommitBranchesField extends PhabricatorCommitCustomField {..

Decoded Output download

<?php

final class PhabricatorCommitBranchesField
  extends PhabricatorCommitCustomField {

  public function getFieldKey() {
    return 'diffusion:branches';
  }

  public function getFieldName() {
    return pht('Branches');
  }

  public function getFieldDescription() {
    return pht('Shows branches a commit appears on in email.');
  }

  public function shouldAppearInTransactionMail() {
    return true;
  }

  public function updateTransactionMailBody(
    PhabricatorMetaMTAMailBody $body,
    PhabricatorApplicationTransactionEditor $editor,
    array $xactions) {

    $params = array(
      'contains' => $this->getObject()->getCommitIdentifier(),
      'repository' => $this->getObject()->getRepository()->getPHID(),
    );

    try {
      $branches_raw = id(new ConduitCall('diffusion.branchquery', $params))
        ->setUser($this->getViewer())
        ->execute();

      $branches = DiffusionRepositoryRef::loadAllFromDictionaries(
        $branches_raw);
      if (!$branches) {
        return;
      }

      $branch_names = mpull($branches, 'getShortName');
      sort($branch_names);
      $branch_text = implode(', ', $branch_names);
    } catch (Exception $ex) {
      $branch_text = pht('<%s: %s>', get_class($ex), $ex->getMessage());
    }

    $body->addTextSection(pht('BRANCHES'), $branch_text);
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorCommitBranchesField
  extends PhabricatorCommitCustomField {

  public function getFieldKey() {
    return 'diffusion:branches';
  }

  public function getFieldName() {
    return pht('Branches');
  }

  public function getFieldDescription() {
    return pht('Shows branches a commit appears on in email.');
  }

  public function shouldAppearInTransactionMail() {
    return true;
  }

  public function updateTransactionMailBody(
    PhabricatorMetaMTAMailBody $body,
    PhabricatorApplicationTransactionEditor $editor,
    array $xactions) {

    $params = array(
      'contains' => $this->getObject()->getCommitIdentifier(),
      'repository' => $this->getObject()->getRepository()->getPHID(),
    );

    try {
      $branches_raw = id(new ConduitCall('diffusion.branchquery', $params))
        ->setUser($this->getViewer())
        ->execute();

      $branches = DiffusionRepositoryRef::loadAllFromDictionaries(
        $branches_raw);
      if (!$branches) {
        return;
      }

      $branch_names = mpull($branches, 'getShortName');
      sort($branch_names);
      $branch_text = implode(', ', $branch_names);
    } catch (Exception $ex) {
      $branch_text = pht('<%s: %s>', get_class($ex), $ex->getMessage());
    }

    $body->addTextSection(pht('BRANCHES'), $branch_text);
  }

}

Function Calls

None

Variables

None

Stats

MD5 e88e76ae3dbdad33ef7ebec7bd92681d
Eval Count 0
Decode Time 91 ms