Merge pull request #5078 from eileenmcnaughton/comment-full-stops
[civicrm-core.git] / CRM / Core / OptionValue.php
index c0b899f302a15e4e5e1591d5bafaa00730b5080b..2edf837dbe600f316ff05ec2aeb313196bc70a56 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        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
 class CRM_Core_OptionValue {
 
   /**
-   * Static field for all the option value information that we can potentially export
+   * Static field for all the option value information that we can potentially export.
    *
    * @var array
-   * @static
    */
   static $_exportableFields = NULL;
 
   /**
-   * Static field for all the option value information that we can potentially export
+   * Static field for all the option value information that we can potentially export.
    *
    * @var array
-   * @static
    */
   static $_importableFields = NULL;
 
   /**
-   * Static field for all the option value information that we can potentially export
+   * Static field for all the option value information that we can potentially export.
    *
    * @var array
-   * @static
    */
   static $_fields = NULL;
 
@@ -63,14 +60,14 @@ class CRM_Core_OptionValue {
    *
    * @param array $groupParams
    *   Array containing group fields whose option-values is to retrieved.
-   * @param string $orderBy
-   *   For orderBy clause.
    * @param array $links
    *   Has links like edit, delete, disable ..etc.
+   * @param string $orderBy
+   *   For orderBy clause.
    *
-   * @return array of option-values
+   * @return array
+   *   Array of option-values
    *
-   * @static
    */
   public static function getRows($groupParams, $links, $orderBy = 'weight') {
     $optionValue = array();
@@ -179,12 +176,11 @@ class CRM_Core_OptionValue {
    * @param array $groupParams
    *   Array containing group fields whose option-values is to retrieved/saved.
    * @param $action
-   * @param int $optionValueIDHas the id of the optionValue being edited, disabled ..etc.
+   * @param int $optionValueID Has the id of the optionValue being edited, disabled ..etc.
    *   Has the id of the optionValue being edited, disabled ..etc.
    *
    * @return CRM_Core_DAO_OptionValue
    *
-   * @static
    */
   public static function addOptionValue(&$params, &$groupParams, &$action, &$optionValueID) {
     $params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
@@ -198,9 +194,9 @@ class CRM_Core_OptionValue {
     // if the corresponding group doesn't exist, create one, provided $groupParams has 'name' in it.
     if (!$optionGroup->id) {
       if ($groupParams['name']) {
-        $newOptionGroup   = CRM_Core_BAO_OptionGroup::add($groupParams, $defaults);
+        $newOptionGroup = CRM_Core_BAO_OptionGroup::add($groupParams, $defaults);
         $params['weight'] = 1;
-        $optionGroupID    = $newOptionGroup->id;
+        $optionGroupID = $newOptionGroup->id;
       }
     }
     else {
@@ -218,7 +214,7 @@ class CRM_Core_OptionValue {
       $fieldValues = array('option_group_id' => $optionGroupID);
       // use the next available value
       /* CONVERT(value, DECIMAL) is used to convert varchar
-               field 'value' to decimal->integer                    */
+      field 'value' to decimal->integer                    */
 
       $params['value'] = (int) CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_OptionValue',
         $fieldValues,
@@ -241,7 +237,7 @@ class CRM_Core_OptionValue {
   }
 
   /**
-   * Check if there is a record with the same name in the db
+   * Check if there is a record with the same name in the db.
    *
    * @param string $value
    *   The value of the field we are checking.
@@ -254,8 +250,8 @@ class CRM_Core_OptionValue {
    * @param string $fieldName
    *   The name of the field in the DAO.
    *
-   * @return boolean     true if object exists
-   * @static
+   * @return bool
+   *   true if object exists
    */
   public static function optionExists($value, $daoName, $daoID, $optionGroupID, $fieldName = 'name') {
     $object = new $daoName();
@@ -271,13 +267,13 @@ class CRM_Core_OptionValue {
   }
 
   /**
-   * Check if there is a record with the same name in the db
+   * Check if there is a record with the same name in the db.
    *
    * @param string $mode
    * @param string $contactType
    *
-   * @return boolean     true if object exists
-   * @static
+   * @return bool
+   *   true if object exists
    */
   public static function getFields($mode = '', $contactType = 'Individual') {
     $key = "$mode $contactType";
@@ -304,7 +300,11 @@ class CRM_Core_OptionValue {
         //the fields email greeting and postal greeting are meant only for Individual and Household
         //the field addressee is meant for all contact types, CRM-4575
         if (in_array($contactType, array(
-          'Individual', 'Household', 'Organization', 'All'))) {
+          'Individual',
+          'Household',
+          'Organization',
+          'All',
+        ))) {
           $nameTitle = array(
             'addressee' => array(
               'name' => 'addressee',
@@ -381,12 +381,11 @@ class CRM_Core_OptionValue {
    * @param string $orderBy
    *   For orderBy clause.
    *
-   * @param bool $isActiveDo you want only active option values?.
-   *   Do you want only active option values?.
+   * @param bool $isActive Do you want only active option values?
    *
-   * @return array of option-values
+   * @return array
+   *   Array of option-values
    *
-   * @static
    */
   public static function getValues($groupParams, &$values, $orderBy = 'weight', $isActive = FALSE) {
     if (empty($groupParams)) {
@@ -455,4 +454,5 @@ FROM
       );
     }
   }
+
 }