示例#1
0
 public function decode($data)
 {
     $this->init();
     require_once $this->path . 'InputStream.php';
     require_once $this->path . 'Amf3/Deserializer.php';
     $stream = new Zend_Amf_Parse_InputStream(substr($data, 1));
     $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($stream);
     return $deserializer->readTypeMarker();
 }
示例#2
0
 /**
  * Deserialize an AMF3 value to PHP
  *
  * @param  mixed $value
  * @param  array $opts
  * @return string
  * @throws Zend_Serializer_Exception
  */
 public function unserialize($value, array $opts = array())
 {
     try {
         $stream = new Zend_Amf_Parse_InputStream($value);
         $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($stream);
         return $deserializer->readTypeMarker();
     } catch (Exception $e) {
         throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e);
     }
 }
示例#3
0
 /**
  * Read an object from the AMF stream and convert it into a PHP object
  *
  * @todo   Rather than using an array of traitsInfo create Zend_Amf_Value_TraitsInfo
  * @return object|array
  */
 public function readObject()
 {
     $returnObject = parent::readObject();
     /*if ($returnObject instanceof \Doctrine\Common\Collections\ArrayCollection) {
     			// If the object we are deserializing is an ArrayCollection we need to set its contents to externalizedData
     			$returnObject->__construct($returnObject->externalizedData);
     		}*/
     /*if ($returnObject instanceof \Flextrine\Collections\FlextrinePersistentCollection) {
     			// If the object we are deserializing is an FlextrinePersistentCollection we need to set its contents to source
     			// TODO: This could maybe be done in __set instead...
     			$returnObject->__construct($returnObject->source);
     		}*/
     return $returnObject;
 }
示例#4
0
 /**
  * AMF3 data type encountered load AMF3 Deserializer to handle
  * type markers.
  *
  * @return string
  */
 public function readAmf3TypeMarker()
 {
     require_once PHP_LIBRARY_PATH . 'Zend/Amf/Parse/Amf3/Deserializer.php';
     $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($this->_stream);
     $this->_objectEncoding = Zend_Amf_Constants::AMF3_OBJECT_ENCODING;
     return $deserializer->readTypeMarker();
 }
示例#5
0
 public function getData()
 {
     $data = file_get_contents('php://input');
     if ($this->format == RestFormat::AMF) {
         require_once 'Zend/Amf/Parse/InputStream.php';
         require_once 'Zend/Amf/Parse/Amf3/Deserializer.php';
         $stream = new Zend_Amf_Parse_InputStream($data);
         $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($stream);
         $data = $deserializer->readTypeMarker();
     } else {
         $data = json_decode($data);
     }
     return $data;
 }
示例#6
0
 /**
  * AMF3 data type encountered load AMF3 Deserializer to handle
  * type markers.
  *
  * @return string
  */
 public function readAmf3TypeMarker()
 {
     $deserializer = new Zend_Amf_Parse_Amf3_Deserializer($this->_stream);
     $this->_objectEncoding = Zend_Amf_Constants::AMF3_OBJECT_ENCODING;
     return $deserializer->readTypeMarker();
 }