示例#1
0
 /**
  * Returns the facets from the response in a form of a multi-dimensional associative array, e.g. array('category' => array('Sports' => '', 'News' => ''));
  * @return array
  */
 public function getFacets()
 {
     return parent::getRawFacets();
 }
 /**
  * Converts SimpleXMLElement to stdClass
  */
 static function simpleXmlToStdClass(SimpleXMLElement &$source)
 {
     $res = new StdClass();
     $children = false;
     foreach ($source as $key => $value) {
         if (isset($res->{$key})) {
             if (!is_array($res->{$key})) {
                 $res->{$key} = array($res->{$key});
             }
             $ref =& $res->{$key};
             $ref[] = CPS_Response::simpleXmlToStdClass($value);
         } else {
             $res->{$key} = CPS_Response::simpleXmlToStdClass($value);
         }
         $children = true;
     }
     if (!$children) {
         return (string) $source;
     }
     return $res;
 }