Esempio n. 1
0
 /**
  * Turn a string into an object graph
  *
  * @param string $string
  * @param string $type
  * @return mixed
  */
 public function deserialize($string, $type)
 {
     $this->visitor->visitType(Type::fromString($type));
     $value = $this->decoder->decode($string);
     $this->navigator->accept($this->navigator, $this->visitor, $value);
     return $this->visitor->getResult();
 }
Esempio n. 2
0
 /**
  * Turn an object graph into a string
  *
  * @param mixed $value
  * @return string
  */
 public function serialize($value)
 {
     $this->navigator->accept($this->navigator, $this->visitor, $value);
     $result = $this->visitor->getResult();
     return $this->encoder->encode($result);
 }