data = $data; } /** * Return the encoded data. * * @return string */ public function data() : string { return $this->data; } /** * Deserialize the encoding with a given serializer and return a persistable object. * * @param Serializer $serializer * @return Persistable */ public function deserializeWith(Serializer $serializer) : Persistable { return $serializer->deserialize($this); } /** * Save the encoding with a given persister. * * @param Persister $persister */ public function saveTo(Persister $persister) : void { $persister->save($this); } /** * Return the size of the encoding in bytes. * * @return int */ public function bytes() : int { return strlen($this->data); } /** * Return the object as a string. * * @return string */ public function __toString() : string { return $this->data; } }