当前位置: 首页>>代码示例>>PHP>>正文


PHP Address::getCity方法代码示例

本文整理汇总了PHP中Address::getCity方法的典型用法代码示例。如果您正苦于以下问题:PHP Address::getCity方法的具体用法?PHP Address::getCity怎么用?PHP Address::getCity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Address的用法示例。


在下文中一共展示了Address::getCity方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLatLong

 public function getLatLong(Address $address)
 {
     try {
         $adr = "";
         if ($address->getLine1() != null) {
             $adr .= $address->getLine1() . " , ";
         }
         if ($address->getZipCode() != null) {
             $adr .= $address->getZipCode() . " ";
         }
         if ($address->getCity() != null) {
             $adr .= $address->getCity();
         }
         $adr .= " FRANCE";
         $formatedAddress = str_replace(" ", "+", $adr);
         if ($formatedAddress != "+FRANCE") {
             $result = file_get_contents($this->url . "address=" . $formatedAddress);
             $json = json_decode($result);
             $lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
             $long = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
             return [$lat, $long];
         }
         return [];
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
     return [];
 }
开发者ID:alex148,项目名称:SmartMastore,代码行数:28,代码来源:GoogleMapService.php

示例2: gettersShouldReturnTheAttributeValue

 /**
  * @test
  */
 public function gettersShouldReturnTheAttributeValue()
 {
     $this->assertAttributeEquals($this->address->getCountry(), 'country', $this->address);
     $this->assertAttributeEquals($this->address->getState(), 'state', $this->address);
     $this->assertAttributeEquals($this->address->getCity(), 'city', $this->address);
     $this->assertAttributeEquals($this->address->getPostalCode(), 'postalCode', $this->address);
     $this->assertAttributeEquals($this->address->getDistrict(), 'district', $this->address);
     $this->assertAttributeEquals($this->address->getStreet(), 'street', $this->address);
     $this->assertAttributeEquals($this->address->getNumber(), 'number', $this->address);
     $this->assertAttributeEquals($this->address->getComplement(), 'complement', $this->address);
 }
开发者ID:leonardorifeli,项目名称:pagseguro,代码行数:14,代码来源:AddressTest.php

示例3: testValidaCity

 public function testValidaCity()
 {
     $city = 'Nome da Cidade';
     $address = new Address();
     $address->setCity($city);
     $this->assertEquals($city, $address->getCity());
 }
开发者ID:dindigital,项目名称:nfe-focus,代码行数:7,代码来源:AddressTest.php

示例4: testAcceptIncompleteAddressParameter

 /**
  * @group shopobjects
  */
 function testAcceptIncompleteAddressParameter()
 {
     // GIVEN
     $incompleteAddressParameter = $this->givenIncompleteAddressParameter();
     // WHEN
     $address = new Address($incompleteAddressParameter);
     // THEN
     $this->assertFalse($address->error());
     $this->assertNotNull($address->getBirthday());
     $this->assertNull($address->getCity());
 }
开发者ID:ePages-de,项目名称:epages-rest-php,代码行数:14,代码来源:AddressTest.php

示例5: __construct

 public function __construct($name, TaxIdNumber $taxIdNumber, Address $address, BankAccount $account)
 {
     $this->name = $name;
     $this->taxIdNumber = (string) $taxIdNumber;
     $this->postalCode = $address->getPostalCode();
     $this->street = $address->getStreet();
     $this->city = $address->getCity();
     $this->country = $address->getCountry();
     $this->bankName = $account->getBankName();
     $this->bankNumber = $account->getBankNumber();
     $this->bicCode = $account->getBicCode();
 }
开发者ID:cocoders,项目名称:event-store,代码行数:12,代码来源:Buyer.php

示例6: modify

 protected function modify(Address $address)
 {
     $q = $this->dao->prepare('UPDATE ' . $this->table() . ' SET TITLE = :title, ADDRESS_1 = :address1, ADDRESS_2 = :address2, ZIP_CODE = :zipCode, CITY = :city, COUNTRY = :country, USER_ID = :userId WHERE ID = :id');
     $q->bindValue(':title', $address->getTitle());
     $q->bindValue(':address1', $address->getAddress1());
     $q->bindValue(':address2', $address->getAddress2());
     $q->bindValue(':zipCode', $address->getZipCode());
     $q->bindValue(':city', $address->getCity());
     $q->bindValue(':country', $address->getCountry());
     $q->bindValue(':userId', $address->getUserId(), PDO::PARAM_INT);
     $q->bindValue(':id', $address->id(), PDO::PARAM_INT);
     $q->execute();
 }
开发者ID:Tipkin-Commons,项目名称:tipkin,代码行数:13,代码来源:AddressesManager_PDO.class.php

示例7: __construct

 public function __construct($name, TaxIdNumber $taxIdNumber, Address $address, BankAccount $account)
 {
     if (!$name) {
         throw new \InvalidArgumentException('Name is required');
     }
     $this->name = $name;
     $this->taxIdNumber = (string) $taxIdNumber;
     $this->postalCode = $address->getPostalCode();
     $this->street = $address->getStreet();
     $this->city = $address->getCity();
     $this->country = $address->getCountry();
     $this->bankName = $account->getBankName();
     $this->bankNumber = $account->getBankNumber();
     $this->bicCode = $account->getBicCode();
 }
开发者ID:cocoders,项目名称:event-store,代码行数:15,代码来源:Seller.php

示例8: getParams

 private function getParams(Address $address)
 {
     $params = array(':id' => $address->getId(), ':street_no' => $address->getStreetNo(), ':street' => $address->getStreet(), ':suburb' => $address->getSuburb(), ':city' => $address->getCity(), ':post_code' => $address->getPostCode());
     return $params;
 }
开发者ID:beshad,项目名称:DROP_OFF_PROJECT_FRI1039,代码行数:5,代码来源:AddressDao.php

示例9: testSetCity

 /**
  * @todo Implement testSetCity().
  */
 public function testSetCity()
 {
     $this->object->setCity('London');
     $this->assertEquals($this->object->getCity(), 'London');
 }
开发者ID:swat30,项目名称:safeballot,代码行数:8,代码来源:AddressTest.php

示例10: Address

 function get_city()
 {
     $province = get_post_value('province');
     $m = new Address();
     $data = $m->getCity($province);
     $this->assign('json', $data);
     $this->setReturnType('json');
     //只返回单值
 }
开发者ID:koery,项目名称:Vcanbuy,代码行数:9,代码来源:DistrictController.class.php

示例11: encodeAddress

 public function encodeAddress(Address $address)
 {
     return ['street' => $address->getStreet(), 'street2' => $address->getStreet2(), 'zip' => $address->getZip(), 'city' => $address->getCity(), 'country' => $address->getCountry(), 'state' => $address->getState(), 'email' => $address->getEmail(), 'tel' => $address->getTel(), 'fax' => $address->getZip()];
 }
开发者ID:tomaj,项目名称:invoice-client,代码行数:4,代码来源:Serializer.php

示例12: sameValueAs

 /**
  * @param Address $other
  * @return bool
  */
 public function sameValueAs(Address $other)
 {
     return $this->getStreet() == $other->getStreet() && $this->getStreetNumber() == $other->getStreetNumber() && $this->getZip() == $other->getZip() && $this->getCity() == $other->getCity();
 }
开发者ID:codeliner,项目名称:php-equalsbuilder,代码行数:8,代码来源:Address.php

示例13: updateAddress

 public function updateAddress(Address $address)
 {
     try {
         if ($address != null && ($address->getId() == null || $address->getId() == -1)) {
             return false;
         }
         if (!parent::getBdd()->inTransaction()) {
             parent::getBdd()->beginTransaction();
         }
         $query = "UPDATE ADDRESS SET line1 = :line1, line2 = :line2\n                      , zipcode = :zip, city = :city, latitude = :lat, longitude = :long\n                      WHERE id = :id";
         $request = parent::getBdd()->prepare($query);
         $request->bindParam(':id', $address->getId());
         if ($address->getLine1() != null) {
             $request->bindParam(':line1', $address->getLine1());
         } else {
             $request->bindValue(':line1', null);
         }
         if ($address->getLine2() != null) {
             $request->bindParam(':line2', $address->getLine2());
         } else {
             $request->bindValue(':line2', null);
         }
         if ($address->getZipCode() != null) {
             $request->bindParam(':zip', $address->getZipCode());
         } else {
             $request->bindValue(':zip', null);
         }
         if ($address->getCity() != null) {
             $request->bindParam(':city', $address->getCity());
         } else {
             $request->bindValue(':city', null);
         }
         $latLong = $this->googleMapService->getLatLong($address);
         if (sizeof($latLong) == 2) {
             $request->bindParam(':lat', $latLong[0]);
             $request->bindParam(':long', $latLong[1]);
         } else {
             $request->bindValue(':lat', null);
             $request->bindValue(':long', null);
         }
         $request->execute();
         parent::getBdd()->commit();
         $request->closeCursor();
         return true;
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
     return false;
 }
开发者ID:alex148,项目名称:SmartMastore,代码行数:49,代码来源:AddressService.php

示例14: testSetCityWorks

 public function testSetCityWorks()
 {
     $address = new Address();
     $address->setCity('Novo Hamburgo');
     $this->assertEquals('Novo Hamburgo', $address->getCity());
 }
开发者ID:hilltool,项目名称:tray-php,代码行数:6,代码来源:AddressTest.php


注:本文中的Address::getCity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。