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 AlmanacInterfacePHIDType extends PhabricatorPHIDType { const TYPECON..

Decoded Output download

<?php

final class AlmanacInterfacePHIDType extends PhabricatorPHIDType {

  const TYPECONST = 'AINT';

  public function getTypeName() {
    return pht('Almanac Interface');
  }

  public function newObject() {
    return new AlmanacInterface();
  }

  public function getPHIDTypeApplicationClass() {
    return 'PhabricatorAlmanacApplication';
  }

  protected function buildQueryForObjects(
    PhabricatorObjectQuery $query,
    array $phids) {

    return id(new AlmanacInterfaceQuery())
      ->withPHIDs($phids);
  }

  public function loadHandles(
    PhabricatorHandleQuery $query,
    array $handles,
    array $objects) {

    foreach ($handles as $phid => $handle) {
      $interface = $objects[$phid];

      $id = $interface->getID();

      $device = $interface->getDevice();
      $device_name = $device->getName();
      $address = $interface->getAddress();
      $port = $interface->getPort();
      $network = $interface->getNetwork()->getName();

      $name = pht(
        '%s:%s (%s on %s)',
        $device_name,
        $port,
        $address,
        $network);

      $handle->setObjectName(pht('Interface %d', $id));
      $handle->setName($name);

      if ($device->isDisabled()) {
        $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);
      }
    }
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class AlmanacInterfacePHIDType extends PhabricatorPHIDType {

  const TYPECONST = 'AINT';

  public function getTypeName() {
    return pht('Almanac Interface');
  }

  public function newObject() {
    return new AlmanacInterface();
  }

  public function getPHIDTypeApplicationClass() {
    return 'PhabricatorAlmanacApplication';
  }

  protected function buildQueryForObjects(
    PhabricatorObjectQuery $query,
    array $phids) {

    return id(new AlmanacInterfaceQuery())
      ->withPHIDs($phids);
  }

  public function loadHandles(
    PhabricatorHandleQuery $query,
    array $handles,
    array $objects) {

    foreach ($handles as $phid => $handle) {
      $interface = $objects[$phid];

      $id = $interface->getID();

      $device = $interface->getDevice();
      $device_name = $device->getName();
      $address = $interface->getAddress();
      $port = $interface->getPort();
      $network = $interface->getNetwork()->getName();

      $name = pht(
        '%s:%s (%s on %s)',
        $device_name,
        $port,
        $address,
        $network);

      $handle->setObjectName(pht('Interface %d', $id));
      $handle->setName($name);

      if ($device->isDisabled()) {
        $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED);
      }
    }
  }

}

Function Calls

None

Variables

None

Stats

MD5 8792173548affcb4504e8d6fe3c50dfc
Eval Count 0
Decode Time 95 ms