/** * Denormalizes data back into an object of the given class. * * @param mixed $data data to restore * @param string $class the expected class to instantiate * @param string $format format the given data was extracted from * @param array $context options available to the denormalizer * * @return object */ public function denormalize($data, $class, $format = null, array $context = array()) { if (is_null($data)) { return null; } $this->format = $format; $this->context = $context; $data = new SafeArrayAccess($data); $payer = new Payer(); $payer->addType($data['@type'])->addRef($data['@ref'])->addTitle($data['title'])->addFirstName($data['firstname'])->addSurname($data['surname'])->addCompany($data['company'])->addAddress($this->denormaliseAddress($data))->addEmail($data['email']); $payer->setPhoneNumbers($this->denormalisePhoneNumbers($data)); $payer->setComments($this->denormaliseComments($data)); return $payer; }