Example #1
0
 function fromConnectorResponse($json)
 {
     $this->shortName = $json->shortname;
     if ($json->longname) {
         $this->longName = $json->longname;
     }
     if ($json->description) {
         $this->description = $json->description;
     }
     if ($json->query) {
         $query = get_object_vars($json->query);
         if ($json->query->example) {
             $this->exampleQuery = $query["example"];
         }
         if ($query["context-sets"]) {
             foreach ($query["context-sets"] as $set) {
                 $ctx = new JangleContextSet();
                 $ctx->fromConnectorResponse($set);
                 array_push($this->indexes, $ctx);
             }
         }
     }
     if ($json->developer) {
         $this->developer = $json->developer;
     }
     if ($json->contact) {
         $this->contact = $json->contact;
     }
     if ($json->attribution) {
         $this->attribution = $json->attribution;
     }
     if ($json->syndicationright) {
         $this->syndicationRight = $json->syndicationright;
     }
     if ($json->adultcontent) {
         if ($json->adultcontent == true) {
             $this->adultContent = "True";
         }
     }
     if ($json->language) {
         $this->language = $json->language;
     }
     if ($json->template) {
         $this->template = $json->template;
     }
     if ($json->tags) {
         $this->tags = $json->tags;
     }
     if ($json->inputencoding) {
         $this->inputEncoding = $json->inputencoding;
     }
     if ($json->outputencoding) {
         $this->outputEncoding = $json->outputencoding;
     }
     if ($json->image) {
         $this->image = get_object_vars($json->image);
     }
 }