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 PhabricatorEnumConfigType extends PhabricatorTextConfigType { cons..

Decoded Output download

<?php

final class PhabricatorEnumConfigType
  extends PhabricatorTextConfigType {

  const TYPEKEY = 'enum';

  public function validateStoredValue(
    PhabricatorConfigOption $option,
    $value) {

    if (!is_string($value)) {
      throw $this->newException(
        pht(
          'Option "%s" is of type "%s", but the configured value is not '.
          'a string.',
          $option->getKey(),
          $this->getTypeKey()));
    }

    $map = $option->getEnumOptions();
    if (!isset($map[$value])) {
      throw $this->newException(
        pht(
          'Option "%s" is of type "%s", but the current value ("%s") is not '.
          'among the set of valid values: %s.',
          $option->getKey(),
          $this->getTypeKey(),
          $value,
          implode(', ', array_keys($map))));
    }
  }

  protected function newControl(PhabricatorConfigOption $option) {
    $map = array(
      '' => pht('(Use Default)'),
    ) + $option->getEnumOptions();

    return id(new AphrontFormSelectControl())
      ->setOptions($map);
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorEnumConfigType
  extends PhabricatorTextConfigType {

  const TYPEKEY = 'enum';

  public function validateStoredValue(
    PhabricatorConfigOption $option,
    $value) {

    if (!is_string($value)) {
      throw $this->newException(
        pht(
          'Option "%s" is of type "%s", but the configured value is not '.
          'a string.',
          $option->getKey(),
          $this->getTypeKey()));
    }

    $map = $option->getEnumOptions();
    if (!isset($map[$value])) {
      throw $this->newException(
        pht(
          'Option "%s" is of type "%s", but the current value ("%s") is not '.
          'among the set of valid values: %s.',
          $option->getKey(),
          $this->getTypeKey(),
          $value,
          implode(', ', array_keys($map))));
    }
  }

  protected function newControl(PhabricatorConfigOption $option) {
    $map = array(
      '' => pht('(Use Default)'),
    ) + $option->getEnumOptions();

    return id(new AphrontFormSelectControl())
      ->setOptions($map);
  }

}

Function Calls

None

Variables

None

Stats

MD5 39bcfc11a9d33cfcf0d4f5284bdf88e3
Eval Count 0
Decode Time 89 ms