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 ConduitPHIDParameterType extends ConduitParameterType { private $i..

Decoded Output download

<?php

final class ConduitPHIDParameterType
  extends ConduitParameterType {

  private $isNullable;

  public function setIsNullable($is_nullable) {
    $this->isNullable = $is_nullable;
    return $this;
  }

  public function getIsNullable() {
    return $this->isNullable;
  }

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

    if ($this->getIsNullable()) {
      if ($value === null) {
        return $value;
      }
    }

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

    return $value;
  }

  protected function getParameterTypeName() {
    if ($this->getIsNullable()) {
      return 'phid|null';
    } else {
      return 'phid';
    }
  }

  protected function getParameterFormatDescriptions() {
    return array(
      pht('A PHID.'),
    );
  }

  protected function getParameterExamples() {
    $examples = array(
      '"PHID-WXYZ-1111222233334444"',
    );

    if ($this->getIsNullable()) {
      $examples[] = 'null';
    }

    return $examples;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class ConduitPHIDParameterType
  extends ConduitParameterType {

  private $isNullable;

  public function setIsNullable($is_nullable) {
    $this->isNullable = $is_nullable;
    return $this;
  }

  public function getIsNullable() {
    return $this->isNullable;
  }

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

    if ($this->getIsNullable()) {
      if ($value === null) {
        return $value;
      }
    }

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

    return $value;
  }

  protected function getParameterTypeName() {
    if ($this->getIsNullable()) {
      return 'phid|null';
    } else {
      return 'phid';
    }
  }

  protected function getParameterFormatDescriptions() {
    return array(
      pht('A PHID.'),
    );
  }

  protected function getParameterExamples() {
    $examples = array(
      '"PHID-WXYZ-1111222233334444"',
    );

    if ($this->getIsNullable()) {
      $examples[] = 'null';
    }

    return $examples;
  }

}

Function Calls

None

Variables

None

Stats

MD5 d9ae4e744767998c46b5e24b4833e13d
Eval Count 0
Decode Time 108 ms