Merge pull request #4029 from joannechester/Relative-date-filters-undeclared-variable...
[civicrm-core.git] / CRM / Utils / Sunlight.php
index a4ab7c0cbf3c0cc7cea70865e4984bc90da82ed0..a6cf20d31c5992549b0a632e5cf87e4deba1d193 100644 (file)
@@ -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);