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 DifferentialParseCommitMessageConduitAPIMethod extends DifferentialCo..

Decoded Output download

<?php

final class DifferentialParseCommitMessageConduitAPIMethod
  extends DifferentialConduitAPIMethod {

  public function getAPIMethodName() {
    return 'differential.parsecommitmessage';
  }

  public function getMethodDescription() {
    return pht('Parse commit messages for Differential fields.');
  }

  protected function defineParamTypes() {
    return array(
      'corpus'  => 'required string',
      'partial' => 'optional bool',
    );
  }

  protected function defineReturnType() {
    return 'nonempty dict';
  }

  protected function execute(ConduitAPIRequest $request) {
    $viewer = $this->getViewer();

    $parser = DifferentialCommitMessageParser::newStandardParser($viewer);

    $is_partial = $request->getValue('partial');
    if ($is_partial) {
      $parser->setRaiseMissingFieldErrors(false);
    }

    $corpus = $request->getValue('corpus');
    if ($corpus === null || !strlen($corpus)) {
      throw new Exception(pht('Field "corpus" must be non-empty.'));
    }
    $field_map = $parser->parseFields($corpus);

    $errors = $parser->getErrors();
    $xactions = $parser->getTransactions();

    $revision_id_value = idx(
      $field_map,
      DifferentialRevisionIDCommitMessageField::FIELDKEY);
    $revision_id_valid_domain = PhabricatorEnv::getProductionURI('');

    return array(
      'errors' => $errors,
      'fields' => $field_map,
      'revisionIDFieldInfo' => array(
        'value' => $revision_id_value,
        'validDomain' => $revision_id_valid_domain,
      ),
      'transactions' => $xactions,
    );
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class DifferentialParseCommitMessageConduitAPIMethod
  extends DifferentialConduitAPIMethod {

  public function getAPIMethodName() {
    return 'differential.parsecommitmessage';
  }

  public function getMethodDescription() {
    return pht('Parse commit messages for Differential fields.');
  }

  protected function defineParamTypes() {
    return array(
      'corpus'  => 'required string',
      'partial' => 'optional bool',
    );
  }

  protected function defineReturnType() {
    return 'nonempty dict';
  }

  protected function execute(ConduitAPIRequest $request) {
    $viewer = $this->getViewer();

    $parser = DifferentialCommitMessageParser::newStandardParser($viewer);

    $is_partial = $request->getValue('partial');
    if ($is_partial) {
      $parser->setRaiseMissingFieldErrors(false);
    }

    $corpus = $request->getValue('corpus');
    if ($corpus === null || !strlen($corpus)) {
      throw new Exception(pht('Field "corpus" must be non-empty.'));
    }
    $field_map = $parser->parseFields($corpus);

    $errors = $parser->getErrors();
    $xactions = $parser->getTransactions();

    $revision_id_value = idx(
      $field_map,
      DifferentialRevisionIDCommitMessageField::FIELDKEY);
    $revision_id_valid_domain = PhabricatorEnv::getProductionURI('');

    return array(
      'errors' => $errors,
      'fields' => $field_map,
      'revisionIDFieldInfo' => array(
        'value' => $revision_id_value,
        'validDomain' => $revision_id_valid_domain,
      ),
      'transactions' => $xactions,
    );
  }

}

Function Calls

None

Variables

None

Stats

MD5 71b7555f6ef1a4cf15ccaab9b7bf31b3
Eval Count 0
Decode Time 87 ms