Merge pull request #4029 from joannechester/Relative-date-filters-undeclared-variable...
[civicrm-core.git] / CRM / Utils / Sunlight.php
index c2a1d35130e257a257147fdcb02a4ba9d34ed219..a6cf20d31c5992549b0a632e5cf87e4deba1d193 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -36,6 +36,12 @@ class CRM_Utils_Sunlight {
   static $_apiURL = 'http://api.sunlightlabs.com/';
   static $_apiKey = NULL;
 
+  /**
+   * @param $uri
+   *
+   * @return SimpleXMLElement
+   * @throws Exception
+   */
   static function makeAPICall($uri) {
     require_once 'HTTP/Request.php';
     $params = array(
@@ -57,6 +63,11 @@ class CRM_Utils_Sunlight {
     return simplexml_load_string($string);
   }
 
+  /**
+   * @param $zipcode
+   *
+   * @return array
+   */
   static function getCityState($zipcode) {
     $key = self::$_apiKey;
     $uri = "places.getCityStateFromZip.php?zip={$zipcode}&apikey={$key}&output=xml";
@@ -65,6 +76,11 @@ class CRM_Utils_Sunlight {
     return array($xml->city, $xml->state);
   }
 
+  /**
+   * @param $peopleID
+   *
+   * @return array
+   */
   static function getDetailedInfo($peopleID) {
     $key = self::$_apiKey;
     $uri = "people.getPersonInfo.php?id={$peopleID}&apikey={$key}&output=xml";
@@ -94,6 +110,11 @@ class CRM_Utils_Sunlight {
     return $result;
   }
 
+  /**
+   * @param $uri
+   *
+   * @return array
+   */
   static function getPeopleInfo($uri) {
     $xml = self::makeAPICall($uri);
 
@@ -104,6 +125,12 @@ class CRM_Utils_Sunlight {
     return $result;
   }
 
+  /**
+   * @param $city
+   * @param $state
+   *
+   * @return array|null
+   */
   static function getRepresentativeInfo($city, $state) {
     if (!$city ||
       !$state
@@ -116,6 +143,11 @@ class CRM_Utils_Sunlight {
     return self::getPeopleInfo($uri);
   }
 
+  /**
+   * @param $state
+   *
+   * @return array|null
+   */
   static function getSenatorInfo($state) {
     if (!$state) {
       return NULL;
@@ -126,6 +158,13 @@ class CRM_Utils_Sunlight {
     return self::getPeopleInfo($uri);
   }
 
+  /**
+   * @param $city
+   * @param $state
+   * @param null $zipcode
+   *
+   * @return array
+   */
   static function getInfo($city, $state, $zipcode = NULL) {
     if ($zipcode) {
       list($city, $state) = self::getCityState($zipcode);