/**
  * Set the postalinfo information in the contact
  * @param eppContactPostalInfo $postal
  * @throws eppException
  */
 public function setPostalInfo(eppContactPostalInfo $postal)
 {
     $postalinfo = $this->createElement('contact:postalInfo');
     if (!$postal instanceof eppContactPostalInfo) {
         throw new eppException('PostalInfo must be filled on eppCreateContact request');
     }
     if ($postal->getType() == eppContact::TYPE_AUTO) {
         // If all fields are ascii, type = int (international) else type = loc (localization)
         if (self::isAscii($postal->getName()) && self::isAscii($postal->getOrganisationName()) && self::isAscii($postal->getStreet(0))) {
             $postal->setType(eppContact::TYPE_INT);
         } else {
             $postal->setType(eppContact::TYPE_LOC);
         }
     }
     $postalinfo->setAttribute('type', $postal->getType());
     $postalinfo->appendChild($this->createElement('contact:name', $postal->getName()));
     if ($postal->getOrganisationName()) {
         $postalinfo->appendChild($this->createElement('contact:org', $postal->getOrganisationName()));
     }
     $postaladdr = $this->createElement('contact:addr');
     $count = $postal->getStreetCount();
     for ($i = 0; $i < $count; $i++) {
         $postaladdr->appendChild($this->createElement('contact:street', $postal->getStreet($i)));
     }
     $postaladdr->appendChild($this->createElement('contact:city', $postal->getCity()));
     if ($postal->getProvince()) {
         $postaladdr->appendChild($this->createElement('contact:sp', $postal->getProvince()));
     }
     $postaladdr->appendChild($this->createElement('contact:pc', $postal->getZipcode()));
     $postaladdr->appendChild($this->createElement('contact:cc', $postal->getCountrycode()));
     $postalinfo->appendChild($postaladdr);
     $this->contactobject->appendChild($postalinfo);
 }