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 PhabricatorDifferentialExtractWorkflow extends PhabricatorDifferentia..

Decoded Output download

<?php

final class PhabricatorDifferentialExtractWorkflow
  extends PhabricatorDifferentialManagementWorkflow {

  protected function didConstruct() {
    $this
      ->setName('extract')
      ->setExamples('**extract** __commit__')
      ->setSynopsis(pht('Extract a diff from a commit.'))
      ->setArguments(
        array(
          array(
            'name' => 'extract',
            'wildcard' => true,
            'help' => pht('Commit to extract.'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $extract = $args->getArg('extract');

    if (!$extract) {
      throw new PhutilArgumentUsageException(
        pht('Specify a commit to extract the diff from.'));
    }

    if (count($extract) > 1) {
      throw new PhutilArgumentUsageException(
        pht('Specify exactly one commit to extract.'));
    }

    $extract = head($extract);

    $commit = id(new DiffusionCommitQuery())
      ->setViewer($viewer)
      ->withIdentifiers(array($extract))
      ->executeOne();

    if (!$commit) {
      throw new PhutilArgumentUsageException(
        pht(
          'Commit "%s" is not valid.',
          $extract));
    }

    $diff = id(new DifferentialDiffExtractionEngine())
      ->setViewer($viewer)
      ->newDiffFromCommit($commit);

    $uri = PhabricatorEnv::getProductionURI($diff->getURI());

    echo tsprintf(
      "%s

    %s
",
      pht('Extracted diff from "%s":', $extract),
      $uri);
  }


}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorDifferentialExtractWorkflow
  extends PhabricatorDifferentialManagementWorkflow {

  protected function didConstruct() {
    $this
      ->setName('extract')
      ->setExamples('**extract** __commit__')
      ->setSynopsis(pht('Extract a diff from a commit.'))
      ->setArguments(
        array(
          array(
            'name' => 'extract',
            'wildcard' => true,
            'help' => pht('Commit to extract.'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $extract = $args->getArg('extract');

    if (!$extract) {
      throw new PhutilArgumentUsageException(
        pht('Specify a commit to extract the diff from.'));
    }

    if (count($extract) > 1) {
      throw new PhutilArgumentUsageException(
        pht('Specify exactly one commit to extract.'));
    }

    $extract = head($extract);

    $commit = id(new DiffusionCommitQuery())
      ->setViewer($viewer)
      ->withIdentifiers(array($extract))
      ->executeOne();

    if (!$commit) {
      throw new PhutilArgumentUsageException(
        pht(
          'Commit "%s" is not valid.',
          $extract));
    }

    $diff = id(new DifferentialDiffExtractionEngine())
      ->setViewer($viewer)
      ->newDiffFromCommit($commit);

    $uri = PhabricatorEnv::getProductionURI($diff->getURI());

    echo tsprintf(
      "%s\n\n    %s\n",
      pht('Extracted diff from "%s":', $extract),
      $uri);
  }


}

Function Calls

None

Variables

None

Stats

MD5 a1f5cb70fa00806d3a2ec329db0c7b70
Eval Count 0
Decode Time 103 ms