Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-02-09-11-44-07
[civicrm-core.git] / CRM / Utils / Array.php
index ec133f691ba93c836c4b9b0eab0d78c2450a8c4b..9471cb0fa2f0b86f6e0040fc4a8bcd5397b2e357 100644 (file)
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * Provides a collection of static methods for array manipulation.
@@ -388,7 +388,7 @@ class CRM_Utils_Array {
   }
 
   /**
-   * convert associative array names to values
+   * convert associative array names to values.
    * and vice-versa.
    *
    * This function is used by both the web form layer and the api. Note that
@@ -440,7 +440,7 @@ class CRM_Utils_Array {
    * @param array $array
    *   (optional) Array to be checked for emptiness.
    *
-   * @return boolean
+   * @return bool
    *   True if the array is empty.
    */
   public static function crmIsEmptyArray($array = array()) {
@@ -531,9 +531,9 @@ class CRM_Utils_Array {
    * @param array $items
    *   The array from which to remove items.
    *
-   * @internal param string|\string[] $key When passed a string, unsets $items[$key].*   When passed a string, unsets $items[$key].
-   *   When passed an array of strings, unsets $items[$k] for each string $k
-   *   in the array.
+   * Additional params:
+   *   When passed a string, unsets $items[$key].
+   *   When passed an array of strings, unsets $items[$k] for each string $k in the array.
    */
   public static function remove(&$items) {
     foreach (func_get_args() as $n => $key) {
@@ -702,7 +702,7 @@ class CRM_Utils_Array {
     return $elementArray;
   }
 
-  /*
+  /**
    * Searches array keys by regex, returning the value of the first match.
    *
    * Given a regular expression and an array, this method searches the keys
@@ -723,13 +723,6 @@ class CRM_Utils_Array {
    * @return mixed
    *   The value found.
    */
-  /**
-   * @param $regexKey
-   * @param $list
-   * @param null $default
-   *
-   * @return null
-   */
   public static function valueByRegexKey($regexKey, $list, $default = NULL) {
     if (is_array($list) && $regexKey) {
       $matches = preg_grep($regexKey, array_keys($list));
@@ -751,18 +744,18 @@ class CRM_Utils_Array {
    * @return array
    *   Each item is a distinct combination of values from $dimensions.
    *
-   * For example, the product of
-   * {
+   *   For example, the product of
+   *   {
    *   fg => {red, blue},
    *   bg => {white, black}
-   * }
-   * would be
-   * {
+   *   }
+   *   would be
+   *   {
    *   {fg => red, bg => white},
    *   {fg => red, bg => black},
    *   {fg => blue, bg => white},
    *   {fg => blue, bg => black}
-   * }
+   *   }
    */
   public static function product($dimensions, $template = array()) {
     if (empty($dimensions)) {
@@ -788,7 +781,7 @@ class CRM_Utils_Array {
   }
 
   /**
-   * Get the first element of an array
+   * Get the first element of an array.
    *
    * @param array $array
    * @return mixed|NULL
@@ -837,4 +830,5 @@ class CRM_Utils_Array {
     }
     return $output;
   }
+
 }