Beispiel #1
0
 private function parse($_data, $fd, $serv)
 {
     $jsonParser = JFactory::getInstance()->parse($_data);
     if ($jsonParser == null) {
         echo "getParser Error" . PHP_EOL;
         return null;
     }
     var_dump($_data);
     $jsonParser->setFd($fd);
     $jsonParser->setServer($serv);
     $result = $jsonParser->parse($_data);
     if ($result) {
         Route::route($jsonParser);
     }
 }
Beispiel #2
0
 public function parse($_data)
 {
     if (!is_array($_data)) {
         $arr = unpack("N/a*", $_data);
         print_r($arr);
         $this->data = \json_decode($arr['1'], true);
     } else {
         $this->data = $_data;
     }
     if (!is_array($this->data)) {
         return null;
     }
     if (!isset($this->data['json'])) {
         return null;
     }
     $this->type = $this->data['json'];
     if (!in_array($this->type, self::$JSON_TYPE, true)) {
         return null;
     }
     $parser = Factory::getInstance($this->type);
     return $parser;
 }