Example #1
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 SerializationException('Serialization failed by previous error', 0, $e);
     }
 }
Example #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);
     }
 }
Example #3
0
 /**
  * Encountered and AMF3 Type Marker use AMF3 serializer. Once AMF3 is
  * encountered it will not return to AMf0.
  *
  * @param  string $data
  * @return Zend\AMF\Parser\AMF0\Serializer
  */
 public function writeAmf3TypeMarker($data)
 {
     $serializer = new Parser\AMF3\Serializer($this->_stream);
     $serializer->writeTypeMarker($data);
     return $this;
 }