Пример #1
0
 public function executeDocumentation($request)
 {
     $browser = new sfWebBrowser();
     $this->prefix = $request->getUriPrefix();
     if ($extraPrefix = $request->getParameter('prefix')) {
         $this->prefix .= $extraPrefix;
     }
     if (!($apiKey = sfConfig::get('app_documentation_admin_key'))) {
         return $this->renderText("Something's broken! Can't display API documentation.");
     }
     $orgId = 1;
     $personId = 1164;
     $relationshipId = 23;
     $listId = 23;
     $this->uris = array('entity_basic' => $this->prefix . '/entity/' . $orgId . '.xml', 'entity_details' => $this->prefix . '/entity/' . $orgId . '/details.xml', 'entity_batch' => $this->prefix . '/batch/entities.xml?ids=1,2,3,1201,28219,35306&details=1', 'entity_aliases' => $this->prefix . '/entity/' . $orgId . '/aliases.xml', 'entity_relationships' => $this->prefix . '/entity/' . $orgId . '/relationships.xml?cat_ids=1,7', 'entity_related' => $this->prefix . '/entity/' . $orgId . '/related.xml?cat_ids=1&order=2&is_current=1', 'entity_leadership' => $this->prefix . '/entity/' . $orgId . '/leadership.xml?is_current=1', 'entity_orgs' => $this->prefix . '/entity/' . $personId . '/orgs.xml', 'entity_degree2' => $this->prefix . '/entity/' . $orgId . '/related/degree2.xml?cat1_ids=1&cat2_ids=1&order1=2&order2=1', 'entity_lists' => $this->prefix . '/entity/' . $orgId . '/lists.xml', 'entity_childorgs' => $this->prefix . '/entity/' . $orgId . '/child-orgs.xml', 'entity_images' => $this->prefix . '/entity/' . $orgId . '/images.xml', 'entity_references' => $this->prefix . '/entity/' . $orgId . '/references.xml', 'entity_rel_references' => $this->prefix . '/entity/' . $orgId . '/relationships/references.xml?cat_ids=1,7', 'relationship_basic' => $this->prefix . '/relationship/' . $relationshipId . '.xml', 'relationship_details' => $this->prefix . '/relationship/' . $relationshipId . '/details.xml', 'relationship_batch' => $this->prefix . '/batch/relationships.xml?ids=' . implode(',', range(74, 95)) . '&details=1', 'relationship_references' => $this->prefix . '/relationship/' . $relationshipId . '/references.xml', 'list_basic' => $this->prefix . '/list/' . $listId . '.xml', 'list_entities' => $this->prefix . '/list/' . $listId . '/entities.xml?type_ids=29', 'entity_search' => $this->prefix . '/entities.xml?q=treasury&type_ids=35', 'entity_lookup' => $this->prefix . '/entities/bioguide_id/O000167.xml', 'entity_chains' => $this->prefix . '/entities/chains/1;2.xml', 'relationship_search' => $this->prefix . '/relationships/1026;1.xml?cat_ids=1', 'list_search' => $this->prefix . '/lists.xml?q=forbes');
     $this->responses = array();
     foreach ($this->uris as $key => $uri) {
         $uri = $this->addKeyToUri($uri, $apiKey);
         if ($browser->get($uri)->responseIsError()) {
             throw new Exception("Couldn't get example URI: " . $uri);
         }
         $text = $browser->getResponseText();
         $this->responses[$key] = LsDataFormat::formatXmlString($text);
     }
 }