CRM-15180 - https://issues.civicrm.org/jira/browse/CRM-15180
[civicrm-core.git] / CRM / Core / OptionGroup.php
index 6049e10b46f0dc39d1af087fcc096f9198d834f3..715629a9d695fefee6a787afedf5d8a710a47043 100644 (file)
@@ -46,6 +46,15 @@ class CRM_Core_OptionGroup {
     'grant_type',
   );
 
+  /**
+   * @param CRM_Core_DAO $dao
+   * @param bool $flip
+   * @param bool $grouping
+   * @param bool $localize
+   * @param string $valueColumnName
+   *
+   * @return array
+   */
   static function &valuesCommon(
     $dao, $flip = FALSE, $grouping = FALSE,
     $localize = FALSE, $valueColumnName = 'label'
@@ -156,12 +165,12 @@ WHERE  v.option_group_id = g.id
   /**
    * Counterpart to values() which removes the item from the cache
    *
-   * @param $name
+   * @param string $name
    * @param $flip
    * @param $grouping
    * @param $localize
    * @param $condition
-   * @param $labelColumnName
+   * @param string $labelColumnName
    * @param $onlyActive
    * @param string $keyColumnName
    */
@@ -172,6 +181,9 @@ WHERE  v.option_group_id = g.id
     unset(self::$_cache[$cacheKey]);
   }
 
+  /**
+   * @return string
+   */
   protected static function createCacheKey() {
     $cacheKey = "CRM_OG_" . serialize(func_get_args());
     return $cacheKey;
@@ -230,7 +242,7 @@ WHERE  v.option_group_id = g.id
   }
 
   /**
-   * Function to lookup titles OR ids for a set of option_value populated fields. The retrieved value
+   * Lookup titles OR ids for a set of option_value populated fields. The retrieved value
    * is assigned a new fieldname by id or id's by title
    * (each within a specificied option_group)
    *
@@ -305,6 +317,13 @@ WHERE  v.option_group_id = g.id
     }
   }
 
+  /**
+   * @param string $groupName
+   * @param $value
+   * @param bool $onlyActiveValue
+   *
+   * @return null
+   */
   static function getLabel($groupName, $value, $onlyActiveValue = TRUE) {
     if (empty($groupName) ||
       empty($value)
@@ -334,6 +353,15 @@ WHERE  v.option_group_id = g.id
     return NULL;
   }
 
+  /**
+   * @param string $groupName
+   * @param $label
+   * @param string $labelField
+   * @param string $labelType
+   * @param string $valueField
+   *
+   * @return null
+   */
   static function getValue($groupName,
     $label,
     $labelField = 'label',
@@ -415,9 +443,7 @@ WHERE  v.option_group_id = g.id
    *                          bool   'is_default'  (optional) - is this the default one to display when rendered in form
    *                          bool   'is_active'   (optional) - should this element be rendered
    * @param int $defaultID (reference) - the option value ID of the default element (if set) is returned else 'null'
-   * @param null $groupTitle
-   *
-   * @internal param string $groupLabel - the optional label of the option group else set to group name
+   * @param null $groupTitle the optional label of the option group else set to group name
    *
    * @access public
    * @static
@@ -458,6 +484,12 @@ WHERE  v.option_group_id = g.id
     return $group->id;
   }
 
+  /**
+   * @param string $groupName
+   * @param $values
+   * @param bool $flip
+   * @param string $field
+   */
   static function getAssoc($groupName, &$values, $flip = FALSE, $field = 'name') {
     $query = "
 SELECT v.id as amount_id, v.value, v.label, v.name, v.description, v.weight
@@ -498,6 +530,10 @@ ORDER BY v.weight
     }
   }
 
+  /**
+   * @param string $groupName
+   * @param string $operator
+   */
   static function deleteAssoc($groupName, $operator = "=") {
     $query = "
 DELETE g, v
@@ -511,6 +547,12 @@ DELETE g, v
     $dao = CRM_Core_DAO::executeQuery($query, $params);
   }
 
+  /**
+   * @param string $groupName
+   * @param $value
+   *
+   * @return null|string
+   */
   static function optionLabel($groupName, $value) {
     $query = "
 SELECT v.label
@@ -525,6 +567,15 @@ SELECT v.label
     return CRM_Core_DAO::singleValueQuery($query, $params);
   }
 
+  /**
+   * @param string $groupName
+   * @param $fieldValue
+   * @param string $field
+   * @param string $fieldType
+   * @param bool $active
+   *
+   * @return array
+   */
   static function getRowValues($groupName, $fieldValue, $field = 'name',
     $fieldType = 'String', $active = TRUE
   ) {
@@ -566,6 +617,10 @@ WHERE  v.option_group_id = g.id
    * which is part of the cache key
    * will do a couple of variations & aspire to someone cleaning it up later
    */
+  /**
+   * @param $name
+   * @param array $params
+   */
   static function flush($name, $params = array()){
     $defaults = array(
       'flip' => FALSE,