Path: blob/master/src/applications/almanac/engineextension/AlmanacSearchEngineAttachment.php
12256 views
<?php12abstract class AlmanacSearchEngineAttachment3extends PhabricatorSearchEngineAttachment {45protected function getAlmanacPropertyList($object) {6$builtins = $object->getAlmanacPropertyFieldSpecifications();78$properties = array();9foreach ($object->getAlmanacProperties() as $key => $property) {10$is_builtin = isset($builtins[$key]);1112$properties[] = array(13'key' => $key,14'value' => $property->getFieldValue(),15'builtin' => $is_builtin,16);17}1819return $properties;20}2122protected function getAlmanacBindingDictionary(AlmanacBinding $binding) {23$interface = $binding->getInterface();2425return array(26'id' => (int)$binding->getID(),27'phid' => $binding->getPHID(),28'properties' => $this->getAlmanacPropertyList($binding),29'interface' => $this->getAlmanacInterfaceDictionary($interface),30'disabled' => (bool)$binding->getIsDisabled(),31);32}3334protected function getAlmanacInterfaceDictionary(35AlmanacInterface $interface) {3637return array(38'id' => (int)$interface->getID(),39'phid' => $interface->getPHID(),40'address' => $interface->getAddress(),41'port' => (int)$interface->getPort(),42'device' => $this->getAlmanacDeviceDictionary($interface->getDevice()),43'network' => $this->getAlmanacNetworkDictionary($interface->getNetwork()),44);45}4647protected function getAlmanacDeviceDictionary(AlmanacDevice $device) {48return array(49'id' => (int)$device->getID(),50'phid' => $device->getPHID(),51'name' => $device->getName(),52'properties' => $this->getAlmanacPropertyList($device),53'status' => $device->getStatus(),54'disabled' => $device->isDisabled(),55);56}5758protected function getAlmanacNetworkDictionary(AlmanacNetwork $network) {59return array(60'id' => (int)$network->getID(),61'phid' => $network->getPHID(),62'name' => $network->getName(),63);64}6566}676869