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 ConduitUserParameterType extends ConduitParameterType { protected ..

Decoded Output download

<?php

final class ConduitUserParameterType
  extends ConduitParameterType {

  protected function getParameterValue(array $request, $key, $strict) {
    $value = parent::getParameterValue($request, $key, $strict);

    if ($value === null) {
      return null;
    }

    if (!is_string($value)) {
      $this->raiseValidationException(
        $request,
        $key,
        pht('Expected PHID or null, got something else.'));
    }

    $user_phids = id(new PhabricatorUserPHIDResolver())
      ->setViewer($this->getViewer())
      ->resolvePHIDs(array($value));

    return nonempty(head($user_phids), null);
  }

  protected function getParameterTypeName() {
    return 'phid|string|null';
  }

  protected function getParameterFormatDescriptions() {
    return array(
      pht('User PHID.'),
      pht('Username.'),
      pht('Literal null.'),
    );
  }

  protected function getParameterExamples() {
    return array(
      '"PHID-USER-1111"',
      '"alincoln"',
      'null',
    );
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class ConduitUserParameterType
  extends ConduitParameterType {

  protected function getParameterValue(array $request, $key, $strict) {
    $value = parent::getParameterValue($request, $key, $strict);

    if ($value === null) {
      return null;
    }

    if (!is_string($value)) {
      $this->raiseValidationException(
        $request,
        $key,
        pht('Expected PHID or null, got something else.'));
    }

    $user_phids = id(new PhabricatorUserPHIDResolver())
      ->setViewer($this->getViewer())
      ->resolvePHIDs(array($value));

    return nonempty(head($user_phids), null);
  }

  protected function getParameterTypeName() {
    return 'phid|string|null';
  }

  protected function getParameterFormatDescriptions() {
    return array(
      pht('User PHID.'),
      pht('Username.'),
      pht('Literal null.'),
    );
  }

  protected function getParameterExamples() {
    return array(
      '"PHID-USER-1111"',
      '"alincoln"',
      'null',
    );
  }

}

Function Calls

None

Variables

None

Stats

MD5 3fd078537ee9bf9598eb3d0465647add
Eval Count 0
Decode Time 100 ms