当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractResponse::parseResponse方法代码示例

本文整理汇总了PHP中AbstractResponse::parseResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractResponse::parseResponse方法的具体用法?PHP AbstractResponse::parseResponse怎么用?PHP AbstractResponse::parseResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractResponse的用法示例。


在下文中一共展示了AbstractResponse::parseResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseResponse

 public function parseResponse()
 {
     parent::parseResponse();
     if (!$this->wasSuccessful()) {
         return;
     }
     $hits = $this->parsedData->hits->hit;
     if (0 === count($hits)) {
         $this->hits = null;
         return;
     }
     $returnHits = array();
     foreach ($hits as $hit) {
         if (isset($hit->data)) {
             $returnHits[$hit->id] = $hit->data;
         } else {
             $returnHits[$hit->id] = $hit->id;
         }
     }
     foreach ($returnHits as $key => $hit) {
         if (is_object($hit)) {
             foreach ($hit as $dataKey => $data) {
                 $returnHits[$key]->{$dataKey} = !empty($data) ? $data[0] : null;
             }
         }
     }
     $this->hits = $returnHits;
 }
开发者ID:markwilson,项目名称:awscloudsearchphp,代码行数:28,代码来源:SearchResponse.php

示例2: parseResponse

 public function parseResponse()
 {
     parent::parseResponse();
     if (!$this->wasSuccessful()) {
         return;
     }
     $hits = $this->parsedData->hits->hit;
     $this->props = $this->parsedData->hits;
     if (isset($this->parsedData->hits->cursor)) {
         $this->cursor = $this->parsedData->hits->cursor;
     }
     if (isset($this->parsedData->facets)) {
         $this->facets = $this->parsedData->facets;
     }
     if (0 === count($hits)) {
         $this->hits = null;
         return;
     }
     /* Not sure what this is supposed to do
     		 *
             $returnHits = array();
             foreach ($hits as $hit) {
                 if (isset($hit->data)) {
                     $returnHits[$hit->id] = $hit->data;
                 }
                 else {
                     $returnHits[$hit->id] = $hit->id;
                 }
             }
     
             foreach ($returnHits as $key => $hit) {
                 if (is_object($hit)) {
                     foreach ($hit as $dataKey => $data) {
                         $returnHits[$key]->{$dataKey} = (!empty($data) ? $data[0] : null);
                     }
                 }
             }
             $this->hits = $returnHits;
     		*/
     $this->hits = $hits;
 }
开发者ID:raptor404,项目名称:awscloudsearchphp,代码行数:41,代码来源:SearchResponse.php

示例3: parseResponse

 /**
  * Parse the response from AWS
  */
 public function parseResponse()
 {
     parent::parseResponse();
     if (!$this->wasSuccessful()) {
         return;
     }
     // Get actual suggestions as an array
     $suggestions = $this->parsedData->suggest->suggestions;
     if (0 === count($suggestions)) {
         // No suggestions...
         $this->suggestions = null;
         return;
     }
     /*
             $returnSuggestions = array();
             foreach ($suggestions as $suggestion) {
                 if (isset($suggestion->suggestion)) {
                     $returnSuggestions[$suggestion->id] = $suggestion->suggestion;
                 }
             }
     */
     $this->suggestions = $suggestions;
 }
开发者ID:raptor404,项目名称:awscloudsearchphp,代码行数:26,代码来源:SuggestResponse.php


注:本文中的AbstractResponse::parseResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。