Merge pull request #6108 from sudhabisht/CRM-16772
[civicrm-core.git] / CRM / Utils / Geocode / Yahoo.php
index 10d01f4c5cbc838902bb2e8f73245d300513b962..f5b22f92bd2581c4e3add68f9a2ec218e7bca310 100644 (file)
@@ -3,7 +3,7 @@
   +--------------------------------------------------------------------+
   | CiviCRM version 4.6                                                |
   +--------------------------------------------------------------------+
-  | Copyright CiviCRM LLC (c) 2004-2014                                |
+  | Copyright CiviCRM LLC (c) 2004-2015                                |
   +--------------------------------------------------------------------+
   | This file is a part of CiviCRM.                                    |
   |                                                                    |
   | GNU Affero General Public License or the licensing of CiviCRM,     |
   | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
   +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -43,15 +43,13 @@ class CRM_Utils_Geocode_Yahoo {
    * Server to retrieve the lat/long
    *
    * @var string
-   * @static
    */
   static protected $_server = 'query.yahooapis.com';
 
   /**
-   * Uri of service
+   * Uri of service.
    *
    * @var string
-   * @static
    */
   static protected $_uri = '/v1/public/yql';
 
@@ -65,8 +63,8 @@ class CRM_Utils_Geocode_Yahoo {
    * @param bool $stateName
    *   This parameter currently has no function.
    *
-   * @return boolean true if we modified the address, false otherwise
-   * @static
+   * @return bool
+   *   true if we modified the address, false otherwise
    */
   public static function format(&$values, $stateName = FALSE) {
     CRM_Utils_System::checkPHPVersion(5, TRUE);
@@ -120,7 +118,7 @@ class CRM_Utils_Geocode_Yahoo {
 
     $add = 'q=' . urlencode('select * from geo.placefinder where ');
 
-    $add .= join(urlencode(' and '), $whereComponents);
+    $add .= implode(urlencode(' and '), $whereComponents);
 
     $add .= "&appid=" . urlencode($config->mapAPIKey);
 
@@ -174,7 +172,7 @@ class CRM_Utils_Geocode_Yahoo {
             if (CRM_Utils_System::isUserLoggedIn()) {
               $msg = ts('The Yahoo Geocoding system returned a different postal code (%1) than the one you entered (%2). If you want the Yahoo value, please delete the current postal code and save again.', array(
                 1 => $ret['postal'],
-                2 => $current_pc_suffix ? "$current_pc-$current_pc_suffix" : $current_pc
+                2 => $current_pc_suffix ? "$current_pc-$current_pc_suffix" : $current_pc,
               ));
 
               CRM_Core_Session::setStatus($msg, ts('Postal Code Mismatch'), 'error');
@@ -187,11 +185,11 @@ class CRM_Utils_Geocode_Yahoo {
           $values['postal_code'] = $ret['postal'];
 
           /* the following logic to split the string was borrowed from
-             CRM/Core/BAO/Address.php -- CRM_Core_BAO_Address::fixAddress.
-             This is actually the function that calls the geocoding
-             script to begin with, but the postal code business takes
-             place before geocoding gets called.
-          */
+          CRM/Core/BAO/Address.php -- CRM_Core_BAO_Address::fixAddress.
+          This is actually the function that calls the geocoding
+          script to begin with, but the postal code business takes
+          place before geocoding gets called.
+           */
 
           if (preg_match('/^(\d{4,5})[+-](\d{4})$/',
             $ret['postal'],
@@ -210,4 +208,5 @@ class CRM_Utils_Geocode_Yahoo {
     $values['geo_code_1'] = $values['geo_code_2'] = 'null';
     return FALSE;
   }
+
 }