Ejemplo n.º 1
0
 /**
  * Decodes input data
  *
  * @param $Input
  *   The data to decode
  */
 public function Decode()
 {
     $Result = false;
     switch ($this->InputMethod) {
         case Request::IT_JSON:
             $this->Data = json_decode($this->Data);
             $Result = true;
             break;
         case Request::IT_XML:
             if (class_exists('XML_Unserializer')) {
                 $serializer = new XML_Unserializer();
                 $serializer->unserialize($this->Data);
                 if (!PEAR::isError($status)) {
                     $this->Data = $serializer->getUnserializedOutput();
                     $Result = true;
                 } else {
                     throw new \Exception('Error in decoding XML input data');
                 }
             } else {
                 throw new \Exception('Pear XML_Serializer package not found!');
             }
             break;
         default:
             throw new \Exception('Invalid input type in configuration file');
             break;
     }
     return $Result;
 }