예제 #1
0
 /**
  * @dataProvider sampleCoordinates
  *
  * @param string $x
  * @param string $y
  */
 public function testXYGettersReturnSetterInjectedValues($x, $y)
 {
     $geo = new CultureFeed_Cdb_Data_Address_GeoInformation('4,7139', '50,88162');
     $geo->setXCoordinate($x);
     $geo->setYCoordinate($y);
     $this->assertEquals($x, $geo->getXCoordinate());
     $this->assertEquals($y, $geo->getYCoordinate());
 }
예제 #2
0
 /**
  * @see CultureFeed_Cdb_IElement::parseFromCdbXml(SimpleXMLElement $xmlElement)
  * @return CultureFeed_Cdb_Data_Address_PhysicalAddress
  */
 public static function parseFromCdbXml(SimpleXMLElement $xmlElement)
 {
     if (empty($xmlElement->city)) {
         throw new CultureFeed_Cdb_ParseException("City is missing for physical address");
     }
     if (empty($xmlElement->country)) {
         throw new CultureFeed_Cdb_ParseException("Country is missing for physical address");
     }
     if (empty($xmlElement->zipcode)) {
         throw new CultureFeed_Cdb_ParseException("Zip code is missing for physical address");
     }
     $physicalAddress = new CultureFeed_Cdb_Data_Address_PhysicalAddress();
     $physicalAddress->setCity((string) $xmlElement->city);
     $physicalAddress->setZip((string) $xmlElement->zipcode);
     if (!empty($xmlElement->street)) {
         $physicalAddress->setStreet((string) $xmlElement->street);
     }
     if (!empty($xmlElement->housenr)) {
         $physicalAddress->setHouseNumber((string) $xmlElement->housenr);
     }
     if (!empty($xmlElement->country)) {
         $physicalAddress->setCountry((string) $xmlElement->country);
     }
     if (!empty($xmlElement->gis)) {
         $physicalAddress->setGeoInformation(CultureFeed_Cdb_Data_Address_GeoInformation::parseFromCdbXml($xmlElement->gis));
     }
     return $physicalAddress;
 }