Example #1
0
 /**
  * Serialize an object with the appropriate visitor
  * @param RequestInterface $object
  * @return string
  * @throws \Upg\Library\AbstractException Should throw exception if there is an error
  */
 public function serialize(RequestInterface $object)
 {
     if (array_key_exists($object->getSerialiseType(), $this->visitors)) {
         $visitor = $this->visitors[$object->getSerialiseType()];
         return $visitor->visit($object, $this);
     } else {
         throw new VisitorCouldNotBeFound($object->getSerialiseType(), $object);
     }
 }