/**
  * Checks whether the given class is supported for denormalization by this normalizer.
  *
  * @param mixed $data Data to denormalize from.
  * @param string $type The class to which the data should be denormalized.
  * @param string $format The format being deserialized from.
  *
  * @return bool
  */
 public function supportsDenormalization($data, $type, $format = null)
 {
     if ($format == "xml" && $type == PhoneNumbers::GetClassName()) {
         return true;
     }
     return false;
 }
 private function denormalisePhoneNumbers($data)
 {
     return $this->serializer->denormalize($data['phonenumbers'], PhoneNumbers::GetClassName(), $this->format, $this->context);
 }
 /**
  * Tests conversion of {@link PaymentRequest} to and from XML using setters for Payer.
  */
 public function testPaymentRequestXmlPayerSetters()
 {
     $request = new PaymentRequest();
     $request->setAccount(SampleXmlValidationUtils::PAYER_NEW_ACCOUNT);
     $request->setMerchantId(SampleXmlValidationUtils::PAYER_NEW_MERCHANT_ID);
     $request->setType(PaymentType::PAYER_NEW);
     $payer = new Payer();
     $payer->setType(SampleXmlValidationUtils::PAYER_NEW_PAYER_TYPE);
     $payer->setRef(SampleXmlValidationUtils::PAYER_NEW_PAYER_REF);
     $payer->setTitle(SampleXmlValidationUtils::PAYER_NEW_PAYER_TITLE);
     $payer->setFirstName(SampleXmlValidationUtils::PAYER_NEW_PAYER_FIRSTNAME);
     $payer->setSurname(SampleXmlValidationUtils::PAYER_NEW_PAYER_SURNAME);
     $payer->setCompany(SampleXmlValidationUtils::PAYER_NEW_PAYER_COMPANY);
     $payer->setEmail(SampleXmlValidationUtils::PAYER_NEW_PAYER_EMAIL);
     $address = new PayerAddress();
     $address->setLine1(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_LINE_1);
     $address->setLine2(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_LINE_2);
     $address->setLine3(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_LINE_3);
     $address->setCity(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_CITY);
     $address->setCounty(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_COUNTY);
     $address->setPostcode(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_POSTCODE);
     $country = new Country();
     $country->setCode(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_COUNTRY_CODE);
     $country->setName(SampleXmlValidationUtils::PAYER_NEW_PAYER_ADDRESS_COUNTRY_NAME);
     $address->setCountry($country);
     $payer->setAddress($address);
     $payer->addComment(SampleXmlValidationUtils::PAYER_NEW_PAYER_COMMENT_1);
     $payer->addComment(SampleXmlValidationUtils::PAYER_NEW_PAYER_COMMENT_2);
     $phoneNumbers = new PhoneNumbers();
     $phoneNumbers->setHomePhoneNumber(SampleXmlValidationUtils::PAYER_NEW_PAYER_HOME_NUMBER);
     $phoneNumbers->setWorkPhoneNumber(SampleXmlValidationUtils::PAYER_NEW_PAYER_WORK_NUMBER);
     $phoneNumbers->setFaxPhoneNumber(SampleXmlValidationUtils::PAYER_NEW_PAYER_FAX_NUMBER);
     $phoneNumbers->setMobilePhoneNumber(SampleXmlValidationUtils::PAYER_NEW_PAYER_MOBILE_NUMBER);
     $payer->setPhoneNumbers($phoneNumbers);
     $request->setPayer($payer);
     $request->setTimeStamp(SampleXmlValidationUtils::PAYER_NEW_TIMESTAMP);
     $request->setOrderId(SampleXmlValidationUtils::PAYER_NEW_ORDER_ID);
     $request->setHash(SampleXmlValidationUtils::PAYER_NEW_REQUEST_HASH);
     // convert to XML
     $xml = $request->toXml();
     // Convert from XML back to PaymentRequest
     /* @var PaymentRequest $fromXmlRequest */
     $fromXmlRequest = new PaymentRequest();
     $fromXmlRequest = $fromXmlRequest->fromXml($xml);
     SampleXmlValidationUtils::checkUnmarshalledPayerNewPaymentRequest($fromXmlRequest, $this);
 }