Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistInspectWorkflow.php
| Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | public function runWorkflow() { | ||||
| } | } | ||||
| $list = implode("\n", $list); | $list = implode("\n", $list); | ||||
| echo tsprintf('%B', $list); | echo tsprintf('%B', $list); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| private function describeRef(ArcanistRefPro $ref, $depth) { | private function describeRef(ArcanistRef $ref, $depth) { | ||||
| $indent = str_repeat(' ', $depth); | $indent = str_repeat(' ', $depth); | ||||
| $out = array(); | $out = array(); | ||||
| $out[] = tsprintf( | $out[] = tsprintf( | ||||
| "%s+ [%s] %s\n", | "%s+ [%s] %s\n", | ||||
| $indent, | $indent, | ||||
| get_class($ref), | get_class($ref), | ||||
| $ref->getRefDisplayName()); | $ref->getRefDisplayName()); | ||||
| $hardpoint_list = $ref->getHardpointList(); | $hardpoint_list = $ref->getHardpointList(); | ||||
| foreach ($hardpoint_list->getHardpoints() as $hardpoint) { | foreach ($hardpoint_list->getHardpoints() as $hardpoint) { | ||||
| $lines = $this->describeHardpoint($ref, $hardpoint, $depth + 1); | $lines = $this->describeHardpoint($ref, $hardpoint, $depth + 1); | ||||
| foreach ($lines as $line) { | foreach ($lines as $line) { | ||||
| $out[] = $line; | $out[] = $line; | ||||
| } | } | ||||
| } | } | ||||
| return $out; | return $out; | ||||
| } | } | ||||
| private function describeHardpoint( | private function describeHardpoint( | ||||
| ArcanistRefPro $ref, | ArcanistRef $ref, | ||||
| ArcanistHardpoint $hardpoint, | ArcanistHardpoint $hardpoint, | ||||
| $depth) { | $depth) { | ||||
| $indent = str_repeat(' ', $depth); | $indent = str_repeat(' ', $depth); | ||||
| $children = array(); | $children = array(); | ||||
| $values = array(); | $values = array(); | ||||
| $hardpoint_key = $hardpoint->getHardpointKey(); | $hardpoint_key = $hardpoint->getHardpointKey(); | ||||
| if ($ref->hasAttachedHardpoint($hardpoint_key)) { | if ($ref->hasAttachedHardpoint($hardpoint_key)) { | ||||
| $mode = '*'; | $mode = '*'; | ||||
| $value = $ref->getHardpoint($hardpoint_key); | $value = $ref->getHardpoint($hardpoint_key); | ||||
| if ($value instanceof ArcanistRefPro) { | if ($value instanceof ArcanistRef) { | ||||
| $children[] = $value; | $children[] = $value; | ||||
| } else if (is_array($value)) { | } else if (is_array($value)) { | ||||
| foreach ($value as $key => $child) { | foreach ($value as $key => $child) { | ||||
| if ($child instanceof ArcanistRefPro) { | if ($child instanceof ArcanistRef) { | ||||
| $children[] = $child; | $children[] = $child; | ||||
| } else { | } else { | ||||
| $values[] = $value; | $values[] = $value; | ||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| $values[] = $value; | $values[] = $value; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines | |||||