本文整理汇总了PHP中Country::setCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Country::setCode方法的具体用法?PHP Country::setCode怎么用?PHP Country::setCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Country
的用法示例。
在下文中一共展示了Country::setCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: construct
public static function construct($array)
{
$obj = new Country();
$obj->setName($array['name']);
$obj->setCode($array['code']);
$obj->setStates($array['states']);
return $obj;
}
示例2: buildMerchants
public function buildMerchants($xml)
{
$merchants = new Merchants();
$merchants->setPageOffset((string) $xml->PageOffset);
$merchants->setTotalCount((string) $xml->TotalCount);
// merchant
$merchantArray = array();
foreach ($xml->Merchant as $merchant) {
$tmpMerchant = new Merchant();
$tmpMerchant->setId((string) $merchant->Id);
$tmpMerchant->setName((string) $merchant->Name);
$tmpMerchant->setWebsiteUrl((string) $merchant->WebsiteUrl);
$tmpMerchant->setPhoneNumber((string) $merchant->PhoneNumber);
$tmpMerchant->setCategory((string) $merchant->Category);
$tmpLocation = new Location();
$location = $merchant->Location;
$tmpLocation->setName((string) $location->Name);
$tmpLocation->setDistance((string) $location->Distance);
$tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
$tmpAddress = new Address();
$address = $location->Address;
$tmpAddress->setLine1((string) $address->Line1);
$tmpAddress->setLine2((string) $address->Line2);
$tmpAddress->setCity((string) $address->City);
$tmpAddress->setPostalCode((string) $address->PostCode);
$tmpCountry = new Country();
$tmpCountry->setName((string) $address->Country->Name);
$tmpCountry->setCode((string) $address->Country->Code);
$tmpCountrySubdivision = new CountrySubdivision();
$tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
$tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
$tmpAddress->setCountry($tmpCountry);
$tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
$tmpPoint = new Point();
$point = $location->Point;
$tmpPoint->setLatitude((string) $point->Latitude);
$tmpPoint->setLongitude((string) $point->Longitude);
// ACCEPTANCE FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES>
//$tmpAcceptance = new Acceptance();
//$acceptance = $merchant->Acceptance;
// FEATURES FRAMEWORK NEEDS LOOKED AT <RETURN XML AND DOC DOES NOT HAVE ALL VALUES>
//$tmpFeatures = new Features();
//$features = $merchant->Features;
$tmpLocation->setPoint($tmpPoint);
$tmpLocation->setAddress($tmpAddress);
$tmpMerchant->setLocation($tmpLocation);
array_push($merchantArray, $tmpMerchant);
}
$merchants->setMerchant($merchantArray);
return $merchants;
}
示例3: buildCountries
private function buildCountries($xml)
{
$countries = new Countries();
$countryArray = array();
foreach ($xml->Country as $country) {
$tmpCountry = new Country();
$tmpCountry->setCode((string) $country->Code);
$tmpCountry->setGeoCoding((string) $country->Geocoding);
$tmpCountry->setName((string) $country->Name);
array_push($countryArray, $tmpCountry);
}
$countries->setCountry($countryArray);
return $countries;
}
示例4: buildAtms
public function buildAtms($xml)
{
$atms = new Atms();
$atms->setPageOffset($xml->PageOffset);
$atms->setTotalCount($xml->TotalCount);
$atmArray = array();
foreach ($xml->Atm as $atm) {
$tmpAtm = new Atm();
$tmpAtm->setHandicapAccessible((string) $atm->HandicapAccessible);
$tmpAtm->setCamera((string) $atm->Camera);
$tmpAtm->setAvailability((string) $atm->Availability);
$tmpAtm->setAccessFees((string) $atm->AccessFees);
$tmpAtm->setOwner((string) $atm->Owner);
$tmpAtm->setSharedDeposit((string) $atm->SharedDeposit);
$tmpAtm->setSurchargeFreeAlliance((string) $atm->SurchargeFreeAlliance);
$tmpAtm->setSponsor((string) $atm->Sponsor);
$tmpAtm->setSupportEMV((string) $atm->SupportEMV);
$tmpAtm->setSurchargeFreeAllianceNetwork((string) $atm->SurchargeFreeAllianceNetwork);
$tmpLocation = new Location();
$location = $atm->Location;
$tmpLocation->setName((string) $location->Name);
$tmpLocation->setDistance((string) $location->Distance);
$tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
$tmpAddress = new Address();
$address = $location->Address;
$tmpAddress->setLine1((string) $address->Line1);
$tmpAddress->setLine2((string) $address->Line2);
$tmpAddress->setCity((string) $address->City);
$tmpAddress->setPostalCode((string) $address->PostCode);
$tmpCountry = new Country();
$tmpCountry->setName((string) $address->Country->Name);
$tmpCountry->setCode((string) $address->Country->Code);
$tmpCountrySubdivision = new CountrySubdivision();
$tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
$tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
$tmpAddress->setCountry($tmpCountry);
$tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
$tmpPoint = new Point();
$point = $location->Point;
$tmpPoint->setLatitude((string) $point->Latitude);
$tmpPoint->setLongitude((string) $point->Longitude);
$tmpLocation->setPoint($tmpPoint);
$tmpLocation->setAddress($tmpAddress);
$tmpAtm->setLocation($tmpLocation);
array_push($atmArray, $tmpAtm);
}
$atms->setAtm($atmArray);
return $atms;
}
示例5: buildAtms
public function buildAtms($xml)
{
$pageOffset = (string) $xml->PageOffset;
$totalCount = (string) $xml->TotalCount;
$restaurantArray = array();
foreach ($xml->Restaurant as $restaurant) {
$tmpRestaurant = new Restaurant();
$tmpRestaurant->setId((string) $restaurant->Id);
$tmpRestaurant->setName((string) $restaurant->Name);
$tmpRestaurant->setWebsiteUrl((string) $restaurant->WebsiteUrl);
$tmpRestaurant->setPhoneNumber((string) $restaurant->PhoneNumber);
$tmpRestaurant->setCategory((string) $restaurant->Category);
$tmpRestaurant->setLocalFavoriteInd((string) $restaurant->LocalFavoriteInd);
$tmpRestaurant->setHiddenGemInd((string) $restaurant->HiddenGemInd);
$tmpLocation = new Location();
$location = $restaurant->Location;
$tmpLocation->setName((string) $location->Name);
$tmpLocation->setDistance((string) $location->Distance);
$tmpLocation->setDistanceUnit((string) $location->DistanceUnit);
$tmpAddress = new Address();
$address = $location->Address;
$tmpAddress->setLine1((string) $address->Line1);
$tmpAddress->setLine2((string) $address->Line2);
$tmpAddress->setCity((string) $address->City);
$tmpAddress->setPostalCode((string) $address->PostCode);
$tmpCountry = new Country();
$tmpCountry->setName((string) $address->Country->Name);
$tmpCountry->setCode((string) $address->Country->Code);
$tmpCountrySubdivision = new CountrySubdivision();
$tmpCountrySubdivision->setName((string) $address->CountrySubdivision->Name);
$tmpCountrySubdivision->setCode((string) $address->CountrySubdivision->Code);
$tmpAddress->setCountry($tmpCountry);
$tmpAddress->setCountrySubdivision($tmpCountrySubdivision);
$tmpPoint = new Point();
$point = $location->Point;
$tmpPoint->setLatitude((string) $point->Latitude);
$tmpPoint->setLongitude((string) $point->Longitude);
$tmpLocation->setPoint($tmpPoint);
$tmpLocation->setAddress($tmpAddress);
$tmpRestaurant->setLocation($tmpLocation);
array_push($restaurantArray, $tmpRestaurant);
}
$restaurants = new Restaurants($pageOffset, $totalCount, $restaurantArray);
return $restaurants;
}
示例6: buildMerchantIds
public function buildMerchantIds($xml)
{
$merchantArray = array();
foreach ($xml->ReturnedMerchants->Merchant as $merchant) {
$xmlAddress = $merchant->Address;
$xmlCountrySubdivision = $merchant->Address->CountrySubdivision;
$xmlCountry = $merchant->Address->Country;
$xmlMerchant = $merchant;
$address = new Address();
$address->setLine1((string) $xmlAddress->Line1);
$address->setLine2((string) $xmlAddress->Line2);
$address->setCity((string) $xmlAddress->City);
$address->setPostalCode((string) $xmlAddress->PostalCode);
$countrySubdivision = new CountrySubdivision();
$countrySubdivision->setCode((string) $xmlCountrySubdivision->Code);
$countrySubdivision->setName((string) $xmlCountrySubdivision->Name);
$country = new Country();
$country->setCode((string) $xmlCountry->Code);
$country->setName((string) $xmlCountry->Name);
$address->setCountrySubdivision($countrySubdivision);
$address->setCountry($country);
$tmpMerchant = new Merchant();
$tmpMerchant->setAddress($address);
$tmpMerchant->setPhoneNumber((string) $xmlMerchant->PhoneNumber);
$tmpMerchant->setBrandName((string) $xmlMerchant->BrandName);
$tmpMerchant->setMerchantCategory((string) $xmlMerchant->MerchantCategory);
$tmpMerchant->setMerchantDbaName((string) $xmlMerchant->MerchantDbaName);
$tmpMerchant->setDescriptorText((string) $xmlMerchant->DescriptorText);
$tmpMerchant->setLegalCorporateName((string) $xmlMerchant->LegalCorporateName);
$tmpMerchant->setBrickCount((string) $xmlMerchant->BrickCount);
$tmpMerchant->setComment((string) $xmlMerchant->Comment);
$tmpMerchant->setLocationId((string) $xmlMerchant->LocationId);
$tmpMerchant->setOnlineCount((string) $xmlMerchant->OnlineCount);
$tmpMerchant->setOtherCount((string) $xmlMerchant->OtherCount);
$tmpMerchant->setSoleProprietorName((string) $xmlMerchant->SoleProprietorName);
array_push($merchantArray, $tmpMerchant);
}
$returnedMerchants = new ReturnedMerchants();
$returnedMerchants->setMerchant($merchantArray);
$merchantIds = new MerchantIds();
$merchantIds->setReturnedMerchants($returnedMerchants);
$merchantIds->setMessage($xml->Message);
return $merchantIds;
}
示例7: Country
<?php
require_once __DIR__ . "/../bootstrap.php";
require_once __DIR__ . "/AddUtils.php";
/* AddCountries.php: Loads a list of countries from an XML file and inserts them into
* the doctrine prototype.
*/
$countriesFileName = __DIR__ . "/" . $GLOBALS['dataDir'] . "/Countries.xml";
$countries = simplexml_load_file($countriesFileName);
foreach ($countries as $country) {
$doctrineCountry = new Country();
$code = "";
$name = "";
foreach ($country as $key => $value) {
if ($key == "name") {
$code = (string) $value;
}
if ($key == "description") {
$name = (string) $value;
}
}
$doctrineCountry->setName($name);
$doctrineCountry->setCode($code);
$entityManager->persist($doctrineCountry);
}
$entityManager->flush();