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 PonderQuestionPHIDType extends PhabricatorPHIDType { const TYPECONST..
Decoded Output download
<?php
final class PonderQuestionPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'QUES';
public function getTypeName() {
return pht('Ponder Question');
}
public function newObject() {
return new PonderQuestion();
}
public function getPHIDTypeApplicationClass() {
return 'PhabricatorPonderApplication';
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PonderQuestionQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$question = $objects[$phid];
$id = $question->getID();
$handle->setName("Q{$id}");
$handle->setURI("/Q{$id}");
$handle->setFullName($question->getFullTitle());
}
}
public function canLoadNamedObject($name) {
return preg_match('/^Q\d*[1-9]\d*$/i', $name);
}
public function loadNamedObjects(
PhabricatorObjectQuery $query,
array $names) {
$id_map = array();
foreach ($names as $name) {
$id = (int)substr($name, 1);
$id_map[$id][] = $name;
}
$objects = id(new PonderQuestionQuery())
->setViewer($query->getViewer())
->withIDs(array_keys($id_map))
->execute();
$results = array();
foreach ($objects as $id => $object) {
foreach (idx($id_map, $id, array()) as $name) {
$results[$name] = $object;
}
}
return $results;
}
}
?>
Did this file decode correctly?
Original Code
<?php
final class PonderQuestionPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'QUES';
public function getTypeName() {
return pht('Ponder Question');
}
public function newObject() {
return new PonderQuestion();
}
public function getPHIDTypeApplicationClass() {
return 'PhabricatorPonderApplication';
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PonderQuestionQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$question = $objects[$phid];
$id = $question->getID();
$handle->setName("Q{$id}");
$handle->setURI("/Q{$id}");
$handle->setFullName($question->getFullTitle());
}
}
public function canLoadNamedObject($name) {
return preg_match('/^Q\d*[1-9]\d*$/i', $name);
}
public function loadNamedObjects(
PhabricatorObjectQuery $query,
array $names) {
$id_map = array();
foreach ($names as $name) {
$id = (int)substr($name, 1);
$id_map[$id][] = $name;
}
$objects = id(new PonderQuestionQuery())
->setViewer($query->getViewer())
->withIDs(array_keys($id_map))
->execute();
$results = array();
foreach ($objects as $id => $object) {
foreach (idx($id_map, $id, array()) as $name) {
$results[$name] = $object;
}
}
return $results;
}
}
Function Calls
None |
Stats
MD5 | d6021c5afaa50d719258a030662cb0dd |
Eval Count | 0 |
Decode Time | 102 ms |