private function buildMethodProperties(ConduitAPIMethod $method) { $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()); $status = $method->getMethodStatus(); $reason = $method->getMethodStatusDescription(); switch ($status) { case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: $stability_icon = 'fa-exclamation-triangle yellow'; $stability_label = pht('Unstable Method'); $stability_info = nonempty($reason, pht('This method is new and unstable. Its interface is subject ' . 'to change.')); break; case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: $stability_icon = 'fa-exclamation-triangle red'; $stability_label = pht('Deprecated Method'); $stability_info = nonempty($reason, pht('This method is deprecated.')); break; default: $stability_label = null; break; } if ($stability_label) { $view->addProperty(pht('Stability'), array(id(new PHUIIconView())->setIcon($stability_icon), ' ', phutil_tag('strong', array(), $stability_label . ':'), ' ', $stability_info)); } $view->addProperty(pht('Returns'), $method->getReturnType()); $error_types = $method->getErrorTypes(); $error_types['ERR-CONDUIT-CORE'] = pht('See error message for details.'); $error_description = array(); foreach ($error_types as $error => $meaning) { $error_description[] = hsprintf('<li><strong>%s:</strong> %s</li>', $error, $meaning); } $error_description = phutil_tag('ul', array(), $error_description); $view->addProperty(pht('Errors'), $error_description); $scope = $method->getRequiredScope(); switch ($scope) { case ConduitAPIMethod::SCOPE_ALWAYS: $oauth_icon = 'fa-globe green'; $oauth_description = pht('OAuth clients may always call this method.'); break; case ConduitAPIMethod::SCOPE_NEVER: $oauth_icon = 'fa-ban red'; $oauth_description = pht('OAuth clients may never call this method.'); break; default: $oauth_icon = 'fa-unlock-alt blue'; $oauth_description = pht('OAuth clients may call this method after requesting access to ' . 'the "%s" scope.', $scope); break; } $view->addProperty(pht('OAuth Scope'), array(id(new PHUIIconView())->setIcon($oauth_icon), ' ', $oauth_description)); $view->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY); $view->addTextContent(new PHUIRemarkupView($viewer, $method->getMethodDescription())); return $view; }