Ejemplo n.º 1
0
Archivo: AMF0.php Proyecto: stunti/zf2
 /**
  * Serialize a PHP value to AMF0 format
  * 
  * @param  mixed $value 
  * @param  array $opts 
  * @return string
  * @throws \Zend\Serializer\Exception
  */
 public function serialize($value, array $opts = array())
 {
     try {
         $stream = new AMFParser\OutputStream();
         $serializer = new AMFParser\AMF0\Serializer($stream);
         $serializer->writeTypeMarker($value);
         return $stream->getStream();
     } catch (\Exception $e) {
         throw new SerializationException('Serialization failed by previous error', 0, $e);
     }
 }
Ejemplo n.º 2
0
 /**
  * Serialize a PHP value to AMF3 format
  * 
  * @param  mixed $value 
  * @param  array $opts 
  * @return string
  * @throws Zend\Serializer\Exception
  */
 public function serialize($value, array $opts = array())
 {
     try {
         $stream = new AmfParser\OutputStream();
         $serializer = new AmfParser\Amf3\Serializer($stream);
         $serializer->writeTypeMarker($value);
         return $stream->getStream();
     } catch (\Exception $e) {
         throw new RuntimeException('Serialization failed: ' . $e->getMessage(), 0, $e);
     }
 }
Ejemplo n.º 3
0
 /**
  * Return the output stream content
  *
  * @return string The contents of the output stream
  */
 public function getResponse()
 {
     return $this->_outputStream->getStream();
 }